I am composing a SOAP request message from a WSDL definition, and it
seems that my concept of namespaces is wrong.
The "types" section of the WSDL definition is as follows:
<types>
<s:schema
elementFormDefault="qualified"
targetNamespace="http://www.foo.com"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:bar="http://www.bar.com"
<s:import namespace="http://www.bar.com"/>
<s:element name="update">
<s:complexType>
<s:sequence>
<s:element ref="bar:updateStatusNotification"/>
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
<xs:schema
targetNamespace="http://www.bar.com"
elementFormDefault="unqualified"
attributeFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:baz="http://www.baz.com" <xs:import namespace="http://www.baz.com"/>
<xs:element name="updateStatusNotification"
type="baz:statusNotification"/>
</xs:schema>
<xs:schema
targetNamespace="http://www.baz.com"
elementFormDefault="unqualified"
attributeFormDefault="unqualified"
xmlns:baz="http://www.baz.com"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
<xs:complexType name="statusNotification">
<xs:sequence>
<xs:element name="activityDate" type="xs:date"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
And the "Body" section of my (wrongly) composed SOAP request is as
follows:
<soap-env:Body>
<m0:update xmlns:m0="http://www.foo.com">
<m1:updateStatusNotification xmlns:m1="http://www.bar.com">
<m2:activityDate xmlns:m2="http://www.baz.com">
2006-04-07
</m2:activityDate>
</m1:updateStatusNotification>
</m0:update>
</soap-env:Body>
The rationale i use is as follows:
- First i start with the "update" element of the "http://www.foo.com"
namespace (as this was pointed to by the "part" section of the WSDL
definition. Also, this "update" element in the SOAP request gets the
namespace "http://www.foo.com" because that's its target namespace in
the WSDL.
- Following from the WSDL, the "update" element has a child which
references the "updateStatusNotification" element of the
"http://www.bar.com" namespace. So, in the SOAP request, i add a
"updateStatusNotification" element under the "update" element, and it
is given a namespace of "http://www.bar.com" (because this is the
target namespace of the "updateStatusNotification" element in the WSDL.
- Then, from the WSDL, the "updateStatusNotification" element is of
type "statusNotification" of the "http://www.baz.com" namespace. So i
look for the "statusNoticiation" type in the "http://www.baz.com"
namespace, and find that it has a single child element "activityDate".
So in the SOAP request, i add the "activityDate" element under the
"updateStatusNotification" element and give it a namespace of
"http://www.baz.com" (because this is the target namespace of the
"activityDate" element in the WSDL).
The structure of the SOAP request that i composed is correct, as with
the namespaces, EXCEPT for the namespace of the "activityDate" element.
Now where in my reasoning (above) did i go wrong?
TIA and Regards,
Edwin