<xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema" targetNamespace="http://schemas.xmlsoap.org/soap/envelope" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope"> <xsd:complexType name="NorthwindHeader"> <xsd:element name="GUID" type="string"/> </xsd:complexType> <xsd:complexType name="NorthwindBody"> <xsd:element name="UpdatePO"> <xsd:complexType> <element name="orderID" type="integer"/> <element name="customerNumber" type="integer"/> <element name="item" type="double"/> <element name="quantity" type="double"/> </xsd:complexType> </xsd:element> </xsd:complexType> </xsd:schema>
This schema creates two elements: NorthwindBody and NorthwindHeader. Using the xsi:type attribute, we can extend the SOAP body element with the NorthwindBody complex type and extend the Header element with NorthwindHeader complex type. You can then create the following SOAP document:
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema/instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope" xsi:schemaLocation= "http://www.northwindtraders.com/schemas/NPOSchema.xsd"> <SOAP-ENV:Header xsi:type="NorthwindHeader"> <COM:GUID xmlns:COM="http://comobject.northwindtraders.com"> 10000000-0000-abcd-0000-000000000001 </COM:GUID> </SOAP-ENV:Header> <SOAP-ENV:Body xsi:type="NorthwindBody"> <UpdatePO> <orderID>0</orderID> <customerNumber>999</customerNumber> <item>89</item> <quantity>3000</quantity> </UpdatePO> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
by
updated