Thursday, August 24, 2006

WSDL Notes from W3C Spec


  1. WSDL is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information.

  2. Elements in WSDL:

    1. Types - a container for data type definitions using some type system (such as XSD).

    2. Message – an abstract, typed definition of the data being communicated.

    3. Operation – an abstract description of an action supported by the service.

    4. Port Type – an abstract set of operations supported by one or more endpoints.

    5. Binding – a concrete protocol and data format specification for a particular port type.

    6. Port – a single endpoint defined as a combination of a binding and a network address.

    7. Service – a collection of related endpoints.



  3. WSDL doesn't introduce a type definition language. Supports XSD as canonical type system. Allows using other type definition languages via extensibility.

  4. Binding mechanism is used to attach a specific protocol or data format or structure to an abstract message or operation or end point.

  5. It introduces specific binding extensions for the following protocols and message format : SOAP 1.1, HTTP GET/POST, MIME. Other binding extensions can also be used.

  6. Message definitions are always considered to be an abstract definition of the message content. A message binding describes how the abstract content is mapped into a concrete format.

  7. WSDL has four transmission primitives that an endpoint can support:

    1. One-Way:endpoint receives a message.

    2. Request-Response:endpoint receives a message, and sends a correlated message.

    3. Solicit-Response :endpoint sends a message, and receives a correlated message.

    4. Notification : endpoint sends a message.



  8. There may be any number of binding for a port type. A Binding must specify exactly one protocol. Binding must not specify address information.

  9. A port must not specify more than one address. It must not specify any binding information other than address information.

  10. Ports within service have the following relationship:

    1. None of the ports communicate with each other (e.g. the output of one port is not the input of another).

    2. If a service has several ports that share a port type, but employ different bindings or addresses, the ports are alternatives. This allows a consumer of a WSDL document to choose particular port(s) to communicate with based on some criteria (protocol, distance, etc.).



  11. SOAP Binding extends WSDL with the following extension elements:

    1. soap:binding - Signify that the binding is bound to the SOAP protocol format: Envelop, header and body. URI for the transport attribute of this element signifies which transport of SOAP. Can be HTTP, SMTP, FTP etc.,

    2. soap:operation - Required for the HTTP protocol binding of SOAP. For other SOAP protocol bindings, soap:action attribute must not be specified and this attribute may be omitted.

    3. soap:body - specifies how message parts appear inside soap body element. May be abstract schema defintiions or concrete. If abstract, then serialized according to some encoding style. The soap:body element is used in both RPC-oriented and document-oriented messages, but the style of the enclosing operation has important effects on how the Body section is structured:

      1. If the operation style is rpc each part is a parameter or a return value and appears inside a wrapper element within the body

      2. If the operation style is document there are no additional wrappers, and the message parts appear directly under the SOAP Body element.



    4. soap:address - The SOAP address binding is used to give a port an address (a URI). The URI scheme specified for the address must correspond to the transport specified by the soap:binding.




SOAP Message Embedded in HTTP Request
POST /StockQuote HTTP/1.1 
Host: www.stockquoteserver.com
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn
SOAPAction: "Some-URI"

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org

/soap/envelope/"> 
<soapenv:Body>
<m:GetLastTradePrice xmlns:m="Some-URI">
<m:tickerSymbol>DIS</m:tickerSymbol>
</m:GetLastTradePrice>
</soapenv:Body>
</soapenv:Envelope>

SOAP Message Embedded in HTTP Response



HTTP/1.1 200 OK 
Content-Type: text/xml; charset="utf-8"
Content-Length: nnnn

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org

/soap/envelope/"> 
<soapenv:Body>
<m:GetLastTradePriceResponse xmlns:m="Some-URI">
<m:price>34.5</m:price>
</m:GetLastTradePriceResponse>
</soapenv:Body>
</soapenv:Envelope>

No comments: