WSDL
The Microsoft Press order processing and book distribution services send and receive the five messages specified in the introduction of Part II. These messages are formally described using WSDL.
The root element of a WSDL file is definitions. Attributes are added to this element to define each of the namespaces used.
WSDL Definitions
(00) <definitions
(01) xmlns="http://schemas.xmlsoap.org/wsdl/"
(02) xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
(03) xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
(04) xmlns:xs="http://w3.org/2001/XMLSchema"
(05) xmlns:msp="http://ex.mspress.microsoft.com/orders"
(06) targetNamespace="http://ex.mspress.microsoft.com/orders">
Line 00 The root element of a WSDL file is definitions.
Lines 0105 For convenience, a common convention is to place all the namespace references that are used in the file here. The WSDL namespace is the default, and other namespaces are added for the HTTP transport, SOAP, and XML Schema. The application-specific namespaces for the Microsoft Press order service are also defined.
Line 06 The targetNamespace creates a namespace for all the elements defined in the rest of the WSDL file (messages, portTypes, bindings, services, and ports).
The second section of a WSDL file defines the types that are used in the messages. While schema definitions can be declared directly in the WSDL file, this example shows a more modular approach in which the schemas are maintained in separate files and are included by reference.
WSDL Types
(07) <types>
(08) <xs:schema
(09) elementFormDefault="qualified"
(10) targetNamespace="http://ex.mspress.microsoft.com/orders">
(11) <xs:include schemaLocation="//.../PurchaseOrder.xsd"/>
(12) <xs:include schemaLocation="//.../OrderConfirmation.xsd"/>
(13) <xs:include schemaLocation="//.../EBookAvailableNotice.xsd"/>
(14) <xs:include schemaLocation="//.../EBookRequest.xsd"/>
(15) <xs:include schemaLocation="//.../EBookResponse.xsd"/>
(16) <xs:include schemaLocation="//.../OrderReturn.xsd"/>
(17) </xs:schema>
(18) </types>
Line 07 The second section of a WSDL file defines all the types used by the Web service it describes.
Lines 0817 The schema element is used to describe or import the message content definitions and to specify their namespace.
Lines 1116 A common practice is to separate the message content schema from the WSDL file. While the schema could be included here, our example shows separate schema files for each message.
The next section of a WSDL file defines the set of messages that are used for communication with the service. Each message is given a unique name, and the contents of these messages are defined in terms of its "parts." A message part references one of the elements defined in the types section above.
WSDL Messages
(15) <message name="PurchaseOrder">
(16) <part name="Message" element="msp:PurchaseOrder"/>
(17) </message>
(18) <message name="OrderConfirmation">
(19) <part name="Message" element="msp:OrderConfirmation"/>
(20) </message>
(21) <message name="EBookAvailableNotice">
(22) <part name="Message" element="msp:EBookAvailableNotice"/>
(23) </message>
(24) <message name="EBookRequest">
(25) <part name="Message" element="msp:EBookRequest"/>
(26) </message>
(27) <message name="EBookResponse">
(28) <part name="Message" element="msp:EBookResponse"/>
(29) </message>
(30) <message name="OrderReturn">
(31) <part name="Message" element="msp:OrderReturn"/>
(32) </message>
Line 1517 Each message is referenced by its name attribute. These must be unique within the WSDL document.
Line 16 The contents of the message are specified by the part element(s).
Lines 1832 The other messages used by this service are defined using the same approach.
The four message exchanges demonstrate three types of WSDL operations: One-Way, Request-response, and Notification. They are specified within a portType, which is a named set of abstract operations (and the messages they use).
WSDL portTypes
(33) <portType name="OrderPortType">
(34) <operation name="ProcessOrder">
(35) <input
(36) wsa:Action="http://ex.mspress.microsoft.com/PO"
(37) message="msp:PurchaseOrder"/>
(38) <output message="msp:OrderConfirmation"/>
(39) </operation>
(40) <operation name="EBookAvailableNotice">
(41) <output message="msp:EBookAvailableNotice"/>
(42) </operation>
(43) <operation name="EBookRequest">
(44) <input message="msp:EBookRequest"/>
(45) <output message="msp:EBookResponse"/>
(46) </operation>
(47) <operation name="OrderReturn">
(48) <input message="msp:OrderReturn"/>
(49) </operation>
(50) </portType>
Line 33 The portType identifier for this WSDL file is OrderPortType.
Lines 3439 The ProcessOrder operation is an example of the Request-Response pattern. It receives a PurchaseOrder message as input and returns an OrderConfirmation. The WS-Addressing Action extension is also shown.
Lines 4042 The EBookAvailableNotice operation is an example of the Notification pattern. The endpoint sends an EBookAvailableNotice and does not expect a response.
Lines 4749 The OrderReturn operation is an example of the One-way pattern. The endpoint receives an OrderReturn message and does not respond.
The WSDL binding element defines the message format and underlying transport protocol details. Our example service uses HTTP version 1.1.
WSDL Bindings
(51) <binding name="OrderBinding" type="msp:OrderPortType">
(52) <soap:binding
(53) style="document"
(54) transport="http://schemas.xmlsoap.org/soap/http"/>
(55) <operation name="ProcessOrder">
(56) <input>
(57) <soap:body use="literal" />
(58) </input>
(59) <output>
(60) <soap:body use="literal" />
(61) </output>
(62) </operation>
(63) </binding>
Part I of this book.
Services are the final part of a WSDL file. They are used to associate an abstract service with its specific deployment location.
WSDL Services
(64) <service name="OrderService">
(65) <port name="OrderBinding" binding="msp:OrderBinding">
(66) <soap:address
(67) location="http://ex.mspress.microsoft.com/orders"/>
(68) </port>
(69) </service>
(70) </definitions>