Compartir a través de


Binding Element (Windows CE 5.0)

Send Feedback

The <binding> element in a Web Services Description Language (WSDL) file does the following:

  • Specifies the protocol details for operations defined in the <portType> element.
  • For each operation, describes how to map the abstract content of its messages into a concrete format (for example, defines how the message looks on the wire).

Each <binding> element has name and type attributes.

  • The name attribute provides a unique name for this binding.
  • The type attribute identifies the port type that it binds. This is the same port type defined earlier in the <portType> element.

The following code example from the Calc.wsdl file shows the <binding> element for the Add operation:

<binding name='CalcSoapBinding' type='wsdlns:CalcSoapPort' >
    <stk:binding preferredEncoding='UTF-8'/>
    <soap:binding style='rpc' transport='https://schemas.xmlsoap.org/soap/http' />
...
<operation name='Add' >
      <soap:operation soapAction='http://tempuri.org/action/Calc.Add' />
      <input>
        <soap:body use='encoded' namespace='http://tempuri.org/message/'
         encodingStyle='https://schemas.xmlsoap.org/soap/encoding/' />
      </input>
      <output>
        <soap:body use='encoded' namespace='http://tempuri.org/message/'
         encodingStyle='https://schemas.xmlsoap.org/soap/encoding/' />
      </output>
    </operation>
...
</binding>

In the Calc.wsdl file, the <binding> element has two child elements: <soap:binding> and <operation>.

<soap:binding> Element

A <soap:binding> element has two attributes:

  • The style attribute, which indicates whether the operation is a remote procedure call (RPC) or a document-oriented operation.

    If you do not specify the style attribute in the <operation> element, the default is the value of the style attribute specified in the <soap:binding> element.

  • The transport attribute, which specifies the type of binding to be used.

The following code example from the Calc.wsdl file shows this <soap:binding> element:

    <soap:binding style='rpc' transport='https://schemas.xmlsoap.org/soap/http' />

In this example, the 'rpc' value specified for the style attribute indicates that the operation is an RPC-oriented operation instead of a document-oriented one.

Also, the value for the transport attribute specifies that this binding corresponds to the HTTP binding in the SOAP specification.

<operation> Element

There is one <operation> child element for each operation defined by the <portType> element. The same operation is also specified in the type attribute in the <binding> element.

An <operation> element and its child elements correlate with the corresponding elements in the <portType> element.

Because the <input> and <output> child elements of the <portType> element do not specify a name attribute, the corresponding child elements in the <binding> element also do not specify a name attribute.

In the previous WSDL fragment, the <operation> element identifies the Add operation. This element has the <soap: operation>, <input>, and <output> child elements.

<soap:operation> Element

The <soap:operation> child element provides information for the specific operation as a whole. In this element, you use the optional style attribute to identify the type of operation (document-oriented or RPC-oriented) and the soapAction attribute to identify the handler of this operation.

The following code example of the Calc.wsdl file shows the <soap:operation> element of the Add operation:

...
<operation name='Add' >
      <soap:operation soapAction='http://tempuri.org/action/Calc.Add' />
...

In this example, the <soap:operation> element does not specify a style attribute. Hence, it uses the value of the style attribute specified in the <soap:binding> element as the default.

<input> and <output> Elements

The <input> and <output> child elements can have two child elements:

  • <soap:header>
  • <soap:body>

These child elements specify how the message parts of the operation's input and output appear inside the <Header> or <Body> elements of the SOAP <Envelope> element.

In the Calc.wsdl file, the <input> and <output> elements specify only the <soap:body> element. This indicates that all message parts of the input and output are to appear inside the SOAP body (inside the SOAP <Envelope> element).

    ...
    <operation name='Add' >
...
      <input>
        <soap:body use='encoded' namespace='http://tempuri.org/message/'
          encodingStyle='https://schemas.xmlsoap.org/soap/encoding/' />
      </input>
      <output>
        <soap:body use='encoded' namespace='http://tempuri.org/message/'
          encodingStyle='https://schemas.xmlsoap.org/soap/encoding/' />
      </output>
    </operation>

<soap:body> Element

For each input and output message, the <soap:body> element describes how various message parts appear inside the SOAP <Body> element.

In general, a <soap:body> element has four attributes:

  • The parts attribute, which identifies the part of the message to appear in the <soap:body>.

  • The use attribute, which indicates whether to encode parts of the message.

    If the parts are encoded (use="encoded"), each part references an abstract data type set by the type attribute in the <part> child element of the <message> element.

    These abstract types produce a concrete message by applying encoding specified in the encodingStyle attribute.

  • The encodingStyle attribute, which specifies the type of encoding to perform on various parts of the message.

  • The namespace attribute, which provides namespace for the wrapper element that wraps the parameters in an RPC style operation.

    If the operation style is RPC, each part is a parameter or a return value and appears inside a wrapper element within the SOAP <Body> element.

    The wrapper element is named identically to the operation name and its namespace is the value of the namespace attribute.

In the Calc.wsdl file, the style attribute of the <soap:binding> element is "rpc." This indicates that each part in the message appears within an RPC wrapper element in the body.

See Also

About the Calc.wsdl File | <types> Element | <message> Element | <service> Element | <portType> Element

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.