0

I want to make soap client to the WSDL web service. I will give it soap xml request and then it return soap response xml. And i searched tutorial to make request. I find this stackoverflow question.It is:

Client to send SOAP request and received response

With this question i can get response xml from wsdl web service. But I don't want to use soap request xml as string like as:

soapEnvelop.LoadXml(@"<SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/1999/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/1999/XMLSchema""><SOAP-ENV:Body><HelloWorld xmlns=""http://tempuri.org/"" SOAP-ENV:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/""><int1 xsi:type=""xsd:integer"">12</int1><int2 xsi:type=""xsd:integer"">32</int2></HelloWorld></SOAP-ENV:Body></SOAP-ENV:Envelope>");

I want to create this request xml with c# code. So that i searched tutorial again. And i find this tutorial:

How to construct a soap service request using C# for HTTPWebRequest?

But i can't merge this two tutorial. I am new this subject. How can i create soap request without using string soap xml to get soap xml response. The response can be xml as string. Because i can parse it in web page with javascript.

Thanks for your suggestions.

Community
  • 1
  • 1
Dvlpr
  • 453
  • 3
  • 8
  • 20
  • The example uses wr.GetRequestStream().Write(string). So all you have to do is to take the xml you create and make it a string. With XmlDocument use OuterText. With XDocument use ToString(). – jdweng May 20 '17 at 20:49
  • I want to ask question to you. For example i have one wsdl web service which return soap response xml. To get this soap xml response, how many ways can I follow ? – Dvlpr May 20 '17 at 21:12
  • Add [Service Reference](https://msdn.microsoft.com/en-us/library/bb628652.aspx) to WSDL to your project. It will generate service client code. Then use it! – Alexander Petrov May 20 '17 at 22:51

0 Answers0