wsdl-tsclient icon indicating copy to clipboard operation
wsdl-tsclient copied to clipboard

Ordering of elements in XSD Sequence not honoured

Open Bouke opened this issue 1 year ago • 0 comments

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.

Bouke avatar Feb 15 '24 11:02 Bouke