SOAP XML Property Order is Important

When you construct a SOAP message yourself, when using Perl, for instance, the order of the properties within the SOAP XML element is critical. For example, the UserCredentials type has two properties, Username and Password. The SOAP XML for an instance of this type would look like this:

<UserCredentials xmlns="">

Notice that the Password property is first, followed by Username. The order of the properties in the XML is important because the adCenter deserializer will not interpret the contents of the element correctly if the properties are not in the correct order.

You can determine the correct order of the properties from the WSDL. For example, the following is the definition of the UserCredentials type in,

<xs:complexType name="UserCredentials">
    <xs:element minOccurs="0" name="Password" nillable="true" type="xs:string" />
    <xs:element minOccurs="0" name="Username" nillable="true" type="xs:string" />

All types must be constructed in the sequence that they are specified.

To give another example, the KeywordBid type is defined as:

<xs:complexType name="KeywordBid">
    <xs:element minOccurs="0"
                type="xs:double" />
    <xs:element minOccurs="0"
                type="xs:double" />
    <xs:element name="Keyword"
                type="xs:string" />
    <xs:element minOccurs="0"
                type="xs:double" />

This means that the properties for this type, if included, must be in the following order:


Thank You,

Strohm Armstrong
Programming Writer - adCenter SDK

Comments (4)
  1. Anonymous says:

    There was a question during the Live Meeting this week regarding the correct sequence for SOAP XML elements

  2. Anonymous says:

    This is complete stupidity.

    If you enforce order, why do you enforce labeling?

    Why is your deserializer so fragile?

  3. Anonymous says:

    I just couldn?t leave your website before telling you that we really enjoyed the quality information you offer to your visitors? Will be back often to check up on new posts.

  4. john says:

    The order of elements in the soap xml is relevant only in as much the associated wsdl (through the xsd) enforces it so.

    The problem lies in the middleware implementations that generating service descriptors, usually from classes in a language, will specify a certain order. This is where most of the incompatibilities might arise from.

    Soap and XML per se don't enforce ordering of elements in any means.  

Comments are closed.

Skip to main content