I have a web service that takes a single string parameter.
In my case I need to send a string which is an xml document where one of its elements contains an xml fragment (which I will use to create a file).
So for example I am sending:
<people>
<person>
<name>J Smith</name>
<value><![CDATA[<content>rest of xml document here</content>]]></value>
</person>
</people>
I used .. to create an xml file.
I was wondering if there is a better way to do this rather than using CDATA?. The CDATA files are very small (less than 20KB).
JD
There is no need to use CDATA. You can pass the xml fragment directly as is.
See, for example, http://msdn.microsoft.com/en-us/library/aa480498.aspx
UPDATE:
Steve pointed out that you have a string parameter not XmlElement parameter. I’m not sure if it would still work that way (though I feel like it could :).
Another option besides CDATA and Base64 would be Xml encoding, e.g.