Note that there are some explanatory texts on larger screens.

plurals
  1. POPost SOAP Envelope to WCF service
    primarykey
    data
    text
    <p>I have the following SOAP message that i want to post it to my WCF Service and get response.</p> <pre><code>"&lt;s:Envelope xmlns:a=\"http://www.w3.org/2005/08/addressing\" xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"&gt;\r\n &lt;s:Header&gt;\r\n &lt;a:Action s:mustUnderstand=\"1\"&gt;http://schemas.devleap.com/OrderService/IOrderService/InsertOrder&lt;/a:Action&gt;\r\n &lt;a:MessageID&gt;urn:uuid:4cb619b7-365b-4108-880f-b302029d03c2&lt;/a:MessageID&gt;\r\n &lt;a:ReplyTo&gt;\r\n &lt;a:Address&gt;http://www.w3.org/2005/08/addressing/anonymous&lt;/a:Address&gt;\r\n &lt;/a:ReplyTo&gt;\r\n &lt;/s:Header&gt;\r\n &lt;s:Body&gt;\r\n &lt;InsertOrder xmlns=\"http://schemas.devleap.com/OrderService\"&gt;\r\n &lt;order xmlns:d4p1=\"http://schemas.devleap.com/OrderService/Order\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"&gt;\r\n &lt;d4p1:IdCustomer&gt;2&lt;/d4p1:IdCustomer&gt;\r\n &lt;d4p1:IdOrder&gt;46&lt;/d4p1:IdOrder&gt;\r\n &lt;d4p1:OrderItems xmlns:d5p1=\"http://schemas.devleap.com/OrderService/OrderItems\" xmlns:d5p2=\"http://schemas.devleap.com/OrderService/OrderItem\"&gt;\r\n &lt;d5p1:OrderItem&gt;\r\n &lt;d5p2:IdProduct&gt;P01&lt;/d5p2:IdProduct&gt;\r\n &lt;d5p2:Quantity&gt;5&lt;/d5p2:Quantity&gt;\r\n &lt;d5p2:EuroPrice&gt;20&lt;/d5p2:EuroPrice&gt;\r\n &lt;/d5p1:OrderItem&gt;\r\n &lt;d5p1:OrderItem&gt;\r\n &lt;d5p2:IdProduct&gt;P01&lt;/d5p2:IdProduct&gt;\r\n &lt;d5p2:Quantity&gt;5&lt;/d5p2:Quantity&gt;\r\n &lt;d5p2:EuroPrice&gt;20&lt;/d5p2:EuroPrice&gt;\r\n &lt;/d5p1:OrderItem&gt;\r\n &lt;/d4p1:OrderItems&gt;\r\n &lt;/order&gt;\r\n &lt;/InsertOrder&gt;\r\n &lt;/s:Body&gt;\r\n&lt;/s:Envelope&gt;" </code></pre> <p>How can i post this SOAP to the WCF service? I tried this but i get "The remote server returned an error: (500) Internal Server Error." exception.</p> <pre><code> using (var client = new WebClient()) { client.Headers.Add("Content-Type", "application/soap+xml; charset=utf-8"); var response = client.UploadString("http://localhost:8000/OrderService", data); } </code></pre> <p>If i remove the header from Envelope and add:</p> <pre><code>client.Headers.Add("Content-Type", "application/soap+xml; charset=utf-8"); client.Headers.Add("SOAPAction", "\"http://schemas.devleap.com/OrderService/IOrderService/InsertOrder\""); </code></pre> <p>i get the same error.</p> <p>If i put </p> <pre><code>client.Headers.Add("Content-Type", "text/xml; charset=utf-8"); </code></pre> <p>i get exception that server expects "application/soap+xml; charset=utf-8".</p> <p>If someone knows how to call it right please help.</p> <p>Thank you, Adrya</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.
    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