Note that there are some explanatory texts on larger screens.

plurals
  1. POSend special characters in xml through web service using .net
    primarykey
    data
    text
    <p>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 <code>XmlTextWriter</code> to generate the document, but im having problems when including special characters inside the xml document for example:</p> <p>The document im generating looks like this:</p> <pre><code>&lt;xml-parameter&gt; &lt;some-field&gt; this is text whit a (&gt;) charatcer&lt;/some-field&gt; &lt;/xml-parameter&gt; </code></pre> <p>Using fliddler to inspect the generated request, i see that its begin escaped like this:</p> <pre><code>&amp;lt;xml-parameter&amp;gt; &amp;lt;some-field&amp;gt; this is a text whit a (&amp;amp;gt;) character $lt;/some-field&amp;gt; &amp;lt;xml-parameter&amp;gt; </code></pre> <p>I can see is beign escaped as "<strong>&amp; amp;gt;</strong>" instead of <strong>&amp;gt ;</strong> i all ready tried using the entity instead of the actual character whit no luck thanks in advance =).</p> <p>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.</p> <pre><code>string query = "/AGS_Polizas/INBOUNDLINK/@SOURCEITEMREF = &gt; * "; 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(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload