<![CDATA[ ]]> tag is missing after sending request from WCF test client

66 Views Asked by At

I am creating WCF app on C# where there is only one input parameter: XML string.

I try to send request to my app from WCF test client. Sometimes i need to use <![CDATA[ ]>> wrap inside my tags.

Here is simple example of xml:

<?xml version="1.0" encoding="utf-16" ?>
  <Contract>
    <ContractData>
       <Name><![CDATA[M&M's]]></Name>
    </ContractData>  
  </Contract>

I place this inside WCF test client and send a request.

When i look under debug at my C# code i see that my method gets this string, but CDATA section is not there:

public MyResponse GetContract(string xml) //<--- Here XML is already without CDATA section
{
   //Code to deserialize and generate response
}

So i get an Deserialization Exception, because '&' symbol need to be covered in CDATA. With Name tag without '&' symbol there is no exception.

I tried SoapUI and trial WCF Strom, the same effect. Why WCF clients are eating my CDATA part and how to make them stop doing it?

0

There are 0 best solutions below