2

Hi I need to send plain XML via a ClientBase wcf client in an anomymous field. I used standard .Net Classes, but whatever I have tried, the output of the xml is ecaped

<Body xsi:type="xsd:string">&lt;GetPODsList&gt;&lt;GetPODList_In&gt;&lt;LanguageCode&gt;nl&lt;/LanguageCode&gt;&lt;WebUser&gt;80AA0BF6-E773-4BD7-B2A1-2F0849848520&lt;/WebUser&gt;&lt;DirectionID ...

But the target systems only understands plain xml.

<Body xsi:type="xsd:string"><GetPODsList><GetPODList_In>&<LanguageCode>en</LanguageCode><WebUser>80AA0BF6-E774-4BD7-B2A1-2F0849848520</WebUser><DirectionID ...

Is there a way so the ClientBase will serialize in plain xml. Via an xml attribute or custom XmlSerializer?

Thx

Steven
  • 1,444
  • 17
  • 23
  • You have html not xml. See wiki : https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references. To encode and decode use : System.Net.WebUtility.HtmlEncode(string) and System.Net.WebUtility.HtmlDecode(string) – jdweng May 18 '18 at 09:32
  • Do you mean, send a xml content inside a the `body`? Why don't you use a typed class and let `wcf` do the job? – Ricardo Pontual May 18 '18 at 10:59
  • yes plain xml, the body is used to send all kinds of serialized data. – Steven May 18 '18 at 11:15
  • 1
    @RicardoPontual I have the same issue, and why not let wcf do it? Because the 3rd party expect a really unusual payload... They even expect/demande the xml declaration inside of one of the fields of the body – Alexandre Rondeau Nov 22 '18 at 21:37

0 Answers0