Adding tags to a Header with AddressHeader.CreateAddressHeader

Infoservice 1 Reputation point
2020-11-21T10:44:03.893+00:00

I am trying to add some tags to the Header of a SOAP request, but I cannot insert this tag:
<ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
<Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
</ReplyTo>

I tried to insert it like this:

string cValue = "<Address>http://www.w3.org/2005/08/addressing/anonymous</Address>";
   AddressHeader oReplyTo = AddressHeader.CreateAddressHeader("ReplyTo",
                                                              "http://www.w3.org/2005/08/addressing",
                                                              cValue);

But I got this result:

<ReplyTo xmlns="http://www.w3.org/2005/08/addressing">&lt;Address&gt;http://www.w3.org/2005/08/addressing/anonymous&lt;/Address&gt;</ReplyTo>

How can I do it correctly? Is there any other way besides AddressHeader.CreateAddressHeader?

Thanks for your help.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,939 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.