wsdl-tsclient
wsdl-tsclient copied to clipboard
Ordering of elements in XSD Sequence not honoured
I have the following sequence as defined in a wsdl:
<xs:complexType name="Purchase">
<xs:sequence>
<xs:element name="Customer" nillable="true" type="xs:string" />
<xs:element name="Quantity" type="xs:double" />
</xs:sequence>
</xs:complexType>
When I have the following Purchase
:
{
Quantity: '1',
Customer: "Test",
}
I expect it to be serialised as:
<Purchase>
<Customer>Test</Customer>
<Quantity>1</Quantity>
</Purchase>
However it is serialised in the order I defined the keys, which doesn't match the xsd:
<Purchase>
<Quantity>1</Quantity>
<Customer>Test</Customer>
</Purchase>
As a result the server rejects the message claiming that it doesn't understand the Quantity
element and expects Customer
instead. A xs:sequence
must be serialised in the defined order.