Soap Envelope XML results in invalid soap message

0

I am attempting to create a very simple Soap envelope. But when I add the XML I get the below error.

I cannot determine whats wrong with my message. Any ideas what the issue is?

Microsoft.Web.Services2.SoapFormatException
  HResult=0x80131501
  Message=WSE005: The input was not a valid SOAP message because it has either the wrong name or the wrong namespace. The name specified follows: Envelope. The namespace it was defined under follows: http://www.w3.org/2003/05/soap-envelope.
  Source=Microsoft.Web.Services2
  StackTrace:
   at Microsoft.Web.Services2.SoapEnvelope.PostLoad()
   at Microsoft.Web.Services2.SoapEnvelope.Load(XmlReader xmlReader)
   at System.Xml.XmlDocument.LoadXml(String xml)
   at Spike.Program.Main(String[] args) in C:\Spike\Program.cs:line 30

Code causing the problem:

string soapReq = "<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">    <soap:Header/>    <soap:Body>       <pceh:UploadOrRemovePathologyRequest> </pceh:UploadOrRemovePathologyRequest>    </soap:Body> </soap:Envelope>";
SoapEnvelope req = new SoapEnvelope();
req.LoadXml(soapReq);  // ERROR OCCURS ON THIS LINE

EndpointReference endpoint = new EndpointReference(new Uri("http://mydest...."));
var client = new SClient(endpoint);
SoapEnvelope returnEnvelope = client.RequestResponseMethod(req);
c#
soap
asked on Stack Overflow Apr 24, 2018 by sazr

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0