Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to manually construct a SOAP envelope in C#?
    primarykey
    data
    text
    <p>I am trying to manually construct a SOAP envelope in C#. I initially went down the route of building it up via a StringBuilder and adding it to an XmlDocument via the LoadXml method. However upon execution I am getting an exception along the lines of:</p> <blockquote> <p>System.Xml.XmlException : The ':' character, hexadecimal value 0x3A, cannot be included in a name. Line 1, position 200.</p> </blockquote> <p>The envelope I am trying to create is:</p> <pre><code>&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XmlSchema"&gt; &lt;soap:Header&gt; &lt;wsrp:path soap:actor="http://schemas.xmlsoap.org/soap/actor/next" soap:mustUnderstand="1" xmlns:wsrp="http://schemas.xmlsoap.org/rp"&gt; &lt;wsrp:action&gt; http://abcd.com/Webservices &lt;/wsrp:action&gt; &lt;wsrp:to&gt; http://abcd.com/Webservices.asmx &lt;/wsrp:to&gt; &lt;wsrp:id&gt; uuid:aaaaa0a7-9e46-432b-8f1b-35037077601f &lt;/wsrp:id&gt; &lt;/wsrp:path&gt; &lt;wsu:Timestamp xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"&gt; &lt;wsu:Created&gt; 2012-11-30T10:38:13z &lt;/wsu:Created&gt; &lt;wsu:Expires&gt; 2012-11-30T11:38:13z &lt;/wsu:Expires&gt; &lt;/wsu:Timestamp&gt; &lt;wsse:Security soap:mustUnderstand="1" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext"&gt; &lt;wsse:UsernameToken wsu:Id="SecurityToken-00c26e1a-3b3b-400f-a99a-3aa54cf8c8ff" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility"&gt; &lt;wsse:Username&gt;username&lt;/wsse:Username&gt; &lt;wsse:Password Type="wsse:PasswordText"&gt;password&lt;/wsse:Password&gt; &lt;wsse:Nonce&gt;NBzqolcwIZrAOYw1vLyucDM3sQQ=&lt;/wsse:Nonce&gt; &lt;wsu:Created&gt;2012-11-30T10:38:13z&lt;/wsu:Created&gt; &lt;/wsse:UsernameToken&gt; &lt;/wsse:Security&gt; &lt;/soap:Header&gt; &lt;soap:Body&gt; &lt;MethodName xmlns="http://abcd.com/Webservices"&gt; &lt;ValueField&gt;Ford&lt;/ValueField&gt; &lt;/MethodName&gt; &lt;/soap:Body&gt; &lt;/soap:Envelope&gt; </code></pre> <p>I am struggling to understand why the compiler is unhappy with the ':'. Is there a better way to do this/what am I doing wrong here?</p>
    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.
 

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