Hello
i'm developing a .net application which consumes a java web service, i created the client through wsdl.exe tool and its working fine, one of the method of the web service, receives an xml document as a parameter, and im using an XmlTextWriter
to generate the document, but im having problems when including special characters inside the xml document for example:
The document im generating looks like this:
<xml-parameter>
<some-field> this is text whit a (>) charatcer</some-field>
</xml-parameter>
Using fliddler to inspect the generated request, i see that its begin escaped like this:
<xml-parameter>
<some-field> this is a text whit a (&gt;) character $lt;/some-field>
<xml-parameter>
I can see is beign escaped as "& amp;gt;" instead of > ; i all ready tried using the entity instead of the actual character whit no luck thanks in advance =).
Edit: here's the code is use to generate the xml, basically i use a memory stream and xmltextwriter to generate xml and then read the whole stream, i pass the generated xml to my service proxy.
string query = "/AGS_Polizas/INBOUNDLINK/@SOURCEITEMREF = > * ";
MemoryStream stream = new MemoryStream();
XmlTextWriter writer = new XmlTextWriter(stream, Encoding.UTF8);
writer.Formatting = Formatting.Indented;
writer.Indentation = 4;
writer.WriteStartDocument(true);
writer.WriteStartElement("RunQueryRequest");
writer.WriteAttributeString("xmlns", "http://www.ibm.com/xmlns/db2/cm/beans/1.0/schema");
writer.WriteAttributeString("maxResults", "0");
writer.WriteAttributeString("version", "latest-version(.)");
writer.WriteAttributeString("contentOption", "URL");
writer.WriteAttributeString("retrieveOption", "ITEMTREE");
writer.WriteStartElement("AuthenticationData");
writer.WriteAttributeString("connectString", "SCHEMA=ICMADMIN");
writer.WriteAttributeString("configString", "");
writer.WriteStartElement("ServerDef");
writer.WriteStartElement("ServerType");
writer.WriteString("ICM");
writer.WriteEndElement();
writer.WriteStartElement("ServerName");
writer.WriteString("icmnlsdb");
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteStartElement("LoginData");
writer.WriteStartElement("UserID");
writer.WriteString("icmadmin");
writer.WriteEndElement();
writer.WriteStartElement("Password");
writer.WriteString("Passw0rd");
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteStartElement("QueryCriteria");
writer.WriteStartElement("QueryString");
writer.WriteString(query);
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteEndElement();
writer.Flush();
stream.Seek(0, SeekOrigin.Begin);
StreamReader reader = new StreamReader(stream);
string xml = reader.ReadToEnd();
writer.Close();
reader.Close();