Anatomy of a WSDL (Web Services Description Language)
Web Services Description Language (WSDL)
WSDLs are XML files used to establish a common language for describing web services and information about web services. Each contains elements which, in turn contain descriptions of data – usually using more than one XML schema. Schemas are passed to the Web service so both the sender and receiver understand the exchanged data. For a Web service interaction to occur, both parties need a copy of the same WSDL file.
Anatomy of a WSDL
WSDL Structure is simple once it’s broken down. The following example is a WSDL in a very basic form:
<definitions>
<types>
</types>
<message>
</message>
<portType>
</portType>
<binding>
</binding>
</definitions>
All you’re doing here is defining several web services into one document. You do this by pulling elements (extension elements and service elements) and grouping them together:
- types: Using an XML schema syntax, the Type element defines the data type being used by the web service.
- message: This element gives definition to the data elements of an operation. Each message can be made up of multiple parts that can be compared to the parameters of a function call in traditional programming languages.
- portType: The vital organ of WSDL anatomy. portType describes the web service, each of the actions it can perform and which messages are involved. This element is often compared to a function library, module or class in traditional programming languages.
- bindings: Bidings define the message formats and protocol details for individual ports within the WSDL.
Now we can look at a sample WSDL with some content.
<definitions name="OrderingService">
<message name="placeOrderRequest">
<part name="custName" type="string"/>
<part name="prodNum" type="string"/>
</message>
<message name="placeOrderRequest">
<part name="custName" type="string"/>
<part name="prodNum" type="string"/>
</message>
<portType name="OrderingPort">
<operation name="placeOrder">
<input message="placeOrderRequest"/>
<output message=”placeOrderResponse”/>
</operation>
</portType>
<binding type="OrderingPort" name="OrderingBinding">
<soap: binding style="rpc" transport="http"/>
<operation name="placeOrder"/>
</binding>
<service name="SalesOrderService">
<port binding="OrderingBinding">
<soap:address location="http://..."/>
</port>
</service>
</definitions>
Notice that once the elements are defined we have functionality. This is a very simple example, but it gives a clean look at how WSDLs are built how they are structured and how they work. For more information, refer to the links section below.
Links
WSDL Essentials at Developer. com