Hi,
I'm generating and sending a SOAP envelope to the server, but when the client
is executed I see that the XML elements in the generated SOAP envelope are not
in order as I expect.

I was expecting the XML elements something in this order:
<?xml version="1.0" encoding="utf-8"?> <MessageHeader> <AgreementId>urn:xxx-xxx:::</AgreementId> <ConversationId>20050904-13:30:03.469-8572</ConversationId> <Sequence> <Id>What id is this?</Id> <Number>123</Number> <Total>6</Total> </Sequence> <Service> <type>service.type. what servicetype is this?</type> </Service> <Action>Problem Submit</Action> <MessageData> <MessageId>20050904-13:30:03.469-8572@...</MessageId> <Timestamp>2005-0409T12:10:42</Timestamp> <RefToMessageId>Which reference is this?</RefToMessageId> <TimeToLive>2005-0409T12:10:42</TimeToLive> </MessageData> <Description>This is the message header</Description> <ErrorList> <Error> <Description> Error Description</Description> <codeContent>code content</codeContent> <errorCode>Error Code</errorCode> <severity>severity.type</severity> <location>error location</location> </Error> <highestSeverity>severity.type</highestSeverity> </ErrorList> <id>which id is this?</id> </MessageHeader>
But the generated SOAP envelope comes out as below:
<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetbyName xmlns="urn:Delivery"> <MessageHeader xmlns="urn:MsgHeader"> <MessageData> <Timestamp>2005-04-08T14:29:37</Timestamp> <RefToMessageId>Which reference is this</RefToMessageId> <TimeToLive>2005-04-08T14:29:37</TimeToLive> <MessageId>20050904-13:30:03.469-8572@...</MessageId> </MessageData> <ErrorList> <Error> <location>error location</location> <errorCode>Error Code</errorCode> <codeContent>code content</codeContent> <severity>severity.type</severity> <Description>Error Description</Description> </Error> </ErrorList> <Service> <type>service.type. What servicetype is this?</type> </Service> <highestSeverity>severity.type</highestSeverity> <AgreementId>urn:xxx-xxxx:::</AgreementId> <Action>Problem Submittal</Action> <id>Which id is this</id> <Sequence> <Total>6</Total> <Number>123</Number> <Id>What id is this</Id> </Sequence> </MessageHeader> </GetbyName> </soap:Body> </soap:Envelope>
How do I preserve the order of XML elements in the generated SOAP envelope (both on client/server side). like
<MessageHeader> <AgreementId>... <ConversationId>... <Sequence> <Id>... <Number> ...
Many thanks

In reply to Preserve the sequence of xml elements in the generated SOAP Envelope by chanakya

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.