Using XML Schema in a WSDL Document
  • XML schema design can impact the implementation of a WSDL document.
  • Schemas designed as nested components cannot be used outside the nesting component.
  • Schemas can be reused by organizing components as individual type definitions. These defined types can then be referenced from multiple locations in a WSDL document.

In the code example, the Address data structure defined in the XML schema is used in the message element of the WSDL document.

<wsdl:types>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsd="http://www.school.com/students">
<xsd:element name="wsd:Address">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="street" type="xsd:string"/>
<xsd:element name="city" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element>
</wsdl:types>

<wsdl:definitions
xmlns:wsd="http://www.school.com/students"> <xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <message name="studentMessage">
    <part name="studentPart" type="xsd:string"/>
    <part name="addressPart" type="wsd:Address"/>
  </message>
  <message name="addressMessage">
    <part name="studentPart" type="xsd:string"/>
  </message>
</wsdl:definitions>

Click the Next button to continue.