0

I'm trying to POST SOAP request to sabre in c# console application but it gives an error. I have checked error details it says i may be having some special characters before soap body or in soap body but i didn't have any.

Error Details -

<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"><soap-env:Header/><soap-env:Body><soap-env:Fault><faultcode>soap-env:Client.InvalidEbXmlMessage</faultcode><faultstring>Unable to create envelope from given source: class com.sun.xml.messaging.saaj.soap.dom4j.ElementImpl cannot be cast to class com.sun.xml.messaging.saaj.soap.Envelope (com.sun.xml.messaging.saaj.soap.dom4j.ElementImpl and com.sun.xml.messaging.saaj.soap.Envelope are in unnamed module of loader org.springframework.boot.loader.launch.LaunchedClassLoader @6950e31)</faultstring><detail><StackTrace>javax.xml.soap.SOAPException: Unable to create envelope from given source: class com.sun.xml.messaging.saaj.soap.dom4j.ElementImpl cannot be cast to class com.sun.xml.messaging.saaj.soap.Envelope (com.sun.xml.messaging.saaj.soap.dom4j.ElementImpl and com.sun.xml.messaging.saaj.soap.Envelope are in unnamed module of loader org.springframework.boot.loader.launch.LaunchedClassLoader @6950e31)</StackTrace></detail></soap-env:Fault></soap-env:Body></soap-env:Envelope>

C# SOAP Request Code -

var client3 = new HttpClient();
var request3 = new HttpRequestMessage(HttpMethod.Post, "https://webservices.platform.sabre.com");
request3.Headers.Add("Authorization", d);
request3.Headers.Add("Cookie", "visid_incap_2768617=kSlKoHeWSX6k4I6cGPIi5sCMk2cAAAAAQUIPAAAAAAAQ/smeEN9Nwzlur1q5LTyI");
var content3 = new StringContent("<?xml version=\"1.0\" encoding=\"UTF-8\" ?><SabreCommandLLSRQ ReturnHostCommand=\"true\" Version=\"2.0.0\" xmlns=\"http://webservices.sabre.com/sabreXML/2011/10\"><Request Output=\"SCREEN\"><HostCommand>WETRT*6952836690549</HostCommand></Request></SabreCommandLLSRQ>", Encoding.UTF8, "text/xml");
request3.Content = content3;
var response3 = client3.SendAsync(request3).Result;
//response.EnsureSuccessStatusCode();
var b = await response3.Content.ReadAsStringAsync();

Note: InPostman This SOAP Request is working for me but not in c# console application.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.