WSDL: Difference between revisions

22 bytes added ,  3 December 2007
m
tweak
(Example)
m (tweak)
Line 10: Line 10:
WSDL can be quite formidable to understand for those not used to looking at such things. Probably the easiest way to get to grips with it is to break it down into its various components.
WSDL can be quite formidable to understand for those not used to looking at such things. Probably the easiest way to get to grips with it is to break it down into its various components.


After any initial processing instruction (<?xml version="1.0" encoding="UTF-8"?> or similar) there will be the outer '''<description>''' element, which will typically also define a number of '''''[[namespace]]s''''' that will be used in the document.
After any initial processing instruction (<?xml version="1.0" encoding="UTF-8"?> or similar) there will be the outer '''<definitions>''' element, which will typically also define a number of '''''[[namespace]]s''''' that will be used in the document.


Within that there will (usually, and in WSDL 1.1) be four or five main types of element, grouped together, in the following order:
Within that there will (usually, and in WSDL 1.1) be four or five main types of element, grouped together, in the following order:
Line 22: Line 22:
This arrangement is convenient for machines to read, as each part is defined prior to encountering the parts that use it, but it is confusing for humans, so for that reason we will deal with those sections in reverse order.
This arrangement is convenient for machines to read, as each part is defined prior to encountering the parts that use it, but it is confusing for humans, so for that reason we will deal with those sections in reverse order.


===The "''description''" element===
===The "''definitions''" element===
The description element, as well as serving as the XML document root, also defines (some of) the namespaces used in the document.  Typically these will include:
The definitions element, as well as serving as the XML document root, also defines (some of) the namespaces used in the document.  Typically these will include:


* The base WSDL namespace: ="<span style="color:midnightblue;">xmlns="<nowiki>http://schemas.xmlsoap.org/wsdl/</nowiki>"</span>
* The base WSDL namespace: ="<span style="color:midnightblue;">xmlns="<nowiki>http://schemas.xmlsoap.org/wsdl/</nowiki>"</span>
Line 79: Line 79:


==Example==
==Example==
To illustrate the above here is a sample of a very simple service WSDL... start from the '''''service''''' element at the bottom and work up through the various elements to the types definitions:
To illustrate the above here is a sample of a very simple service WSDL... start from the '''''service''''' element at the bottom and work up through the various elements to the '''''types''''' definitions:


  <?xml version="1.0" encoding="UTF-8" ?>  
  <?xml version="1.0" encoding="UTF-8" ?>  
Line 94: Line 94:
         <xs:complexType>
         <xs:complexType>
           <xs:sequence>
           <xs:sequence>
             <xs:element name="sName" type="xs:string" />  <span style="color:red">--and in the end it is just a string!</span>
             <xs:element name="sName" type="'''xs:string'''" />  <span style="color:red">--and in the end it is just a string!</span>
           </xs:sequence>
           </xs:sequence>
         </xs:complexType>
         </xs:complexType>
Line 101: Line 101:
         <xs:complexType>
         <xs:complexType>
           <xs:sequence>
           <xs:sequence>
             <xs:element name="SayHelloResult" type="xs:string" />  <span style="color:red">--and so it this one!</span>
             <xs:element name="SayHelloResult" type="'''xs:string'''" />  <span style="color:red">--and so it this one!</span>
           </xs:sequence>
           </xs:sequence>
         </xs:complexType>
         </xs:complexType>