WSDL portType Element

The <portType> element combines multiple message elements to form a complete oneway or round-trip operation.
For example, a <portType> can combine one request and one response message into a single request/response operation. This is most commonly used in SOAP services. A portType can define multiple operations.
Lets take a piece of code from the Example Session:
<portType name="HelloWorld_PortType">
      <operation name="sayHelloWorld">
         <input message="tns:SayHelloRequest"/>
         <output message="tns:SayHelloResponse"/>
      </operation>
   </portType>
  • The portType element defines a single operation, called sayHelloWorld.
  • The operation itself consists of a single input message SayHelloRequest
  • The operation itself consists of a single output message SayHelloResponse

Operation Types

The request-response type is the most common operation type, but WSDL defines four types:
Type Definition
One-way The operation can receive a message but will not return a response
Request-response The operation can receive a request and will return a response
Solicit-response The operation can send a request and will wait for a response
Notification The operation can send a message but will not wait for a response

One-way :
The service receives a message. The operation therefore has a single input element. The grammar for a one-way operation is:
<wsdl:definitions .... > <wsdl:portType .... > *
        <wsdl:operation name="nmtoken">
        <wsdl:input name="nmtoken"? message="qname"/>
        </wsdl:operation>
    </wsdl:portType >
</wsdl:definitions>
Request-response:
The service receives a message and sends a response. The operation therefore has one input element, followed by one output element. To encapsulate errors, an optional fault element can also be specified. The grammar for a request-response operation is:
<wsdl:definitions .... >
    <wsdl:portType .... > *
        <wsdl:operation name="nmtoken" parameterOrder="nmtokens">
           <wsdl:input name="nmtoken"? message="qname"/>
           <wsdl:output name="nmtoken"? message="qname"/>
           <wsdl:fault name="nmtoken" message="qname"/>*
        </wsdl:operation>
    </wsdl:portType >
</wsdl:definitions>
Solicit-response:
The service sends a message and receives a response. The operation therefore has one output element, followed by one input element. To encapsulate errors, an optional fault element can also be specified. The grammar for a solicit-response operation is:
<wsdl:definitions .... >
    <wsdl:portType .... > *
        <wsdl:operation name="nmtoken" parameterOrder="nmtokens">
           <wsdl:output name="nmtoken"? message="qname"/>
           <wsdl:input name="nmtoken"? message="qname"/>
           <wsdl:fault name="nmtoken" message="qname"/>*
        </wsdl:operation>
    </wsdl:portType >
</wsdl:definitions>
Notification :
The service sends a message. The operation therefore has a single output element. Following is the grammar for a notification operation:
<wsdl:definitions .... >
   <wsdl:portType .... > *
        <wsdl:operation name="nmtoken">
          <wsdl:output name="nmtoken"? message="qname"/>
          </wsdl:operation>
    </wsdl:portType >
</wsdl:definitions>




References
Wikipedia for WSDL

 



<<Previous <<   || Index ||   >>Next >>

No comments:

Post a Comment