creating SOAP header in a .NET

I'm having a problem creating SOAP header in a .NET

The required SOAP header looks like this:

<s11:Header>< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

<MessageID s11:mustUnderstand="1">uuid:18db2ad2-5bac-11da-a4ef-18db2ad1a4ef</MessageID>

</s11:Header>


But when I create a class derived from SoapHeader called
MessageID contained public member for the element I want to include, the resulting SOAP fragment is this:

<s11:Header>

    <MessageID xmlns="http://schemas.xmlsoap.org/ws/2004/03/addressing">
      <messageID>string</messageID>
    </MessageID>

</s11:Header>

 

Since the element is contained within the parent MessageID, the request fails.


Hope someone can advise me.
Thank you.



Answer this question

creating SOAP header in a .NET

  • HobbyCoder

    Solution:

    [XmlRoot("MessageID",Namespace = "http://schemas.xmlsoap.org/ws/2004/03/addressing")]

    public class MessageID: SoapHeader

    {

    [XmlTextAttribute]

    public string messageid;

    }


  • creating SOAP header in a .NET