Pass XML as input parameter in WS



A have a web method with input parameter type of string. But this parameter actually is not string but xml. The example of input is:



<![CDATA[<check>
<id>12354564</id>
<idMeaning>msisdn</idMeaning>
<amount>500</amount>
</check>]]>


Bellow is snipped form my code where i create the input and call the method



// create xml
var xml = new XElement("check",
new XElement("id", "41504823"),
new XElement("idMeaning", "msisdn"),
new XElement("amount", "500")
);

// add CDATA
var input = new XCData(xml.ToString());

// get client
var client = WSWrapper.GetClient();

// call method
client.DoCheck(input.ToString());


But then I have problems with encoding. If I check request over the wire I can see that xml has been encoded like



&lt;![CDATA[&lt;check&gt;
&lt;id&gt;41504823&lt;/id&gt;
&lt;idMeaning&gt;msisdn&lt;/idMeaning&gt;
&lt;amount&gt;500&lt;/amount&gt;
&lt;/check&gt;]]&gt


How can I prevent this encoding?


No comments:

Post a Comment