# SOAP Webservice XML request/response using HTTPSocket

**URL:** <https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591>\
**Category:** Getting Started\
**Created:** [November 22, 2016, 10:46am UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591 "2016-11-22T10:46:22Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![isha\_parmar](https://forum.xojo.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@isha\_parmar](https://forum.xojo.com/u/isha_parmar)\
**Post date:** [November 22, 2016, 10:46am UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591/1 "2016-11-22T10:46:22Z")

</div>

Hi  
Can you guys please help with some SOAP/HTTPSocket webservice question as I’m new to XOJO .I have to communicate with third party soap webservice with my XOJO application.  
Third Party wsdl has 4 operations and need to call one after another. So my focus is how to call the first operation for the time being.  
Its takes XML as a request and returns XML response if I try the same in web browser.

I have used HTTPSocket and my res is giving faultstring  
step 1 wsdlAddress for wsdl address  
step 2 result for the output of HTTPSOCKET.post XMLDocument type  
step 3 Creating HTTPSocket variable  
step 4 SetRequestHeader for the soap action for one of the methods in wsdl // can you please cross check if the order or the syntax is not wrong  
step 5 SetRequestContent for xmldic which a xml document created as per requirements and type which is xml.  
the same xml doc is working on web browser setup.  
step 6 result is populated with the output response of HTTPSOCKET.post

Dim wsdlAddress as String = “http://…wsdl”  
Dim result as XmlDocument  
Dim sock as New HTTPSocket  
sock.SetRequestHeader(“SOAPAction”, “Method1”)  
sock.SetRequestContent(xmldoc.ToString,"text/xml) //xmldoc is an xml document created as per requirement  
result = New XmlDocument(sock.Post( wsdlAddress,20 ))

result is

 \<?xml version="1.0" encoding="UTF-8?\>

\<SOAP-ENV:Envelope xmlns:SOAP-ENV="[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)\>  
SOAP-ENV:Body  
SOAP-ENV:Fault  
SOAP-ENV:Server  
incorrect structure of soapaction: Method1  
\</SOAP-ENV:Fault\>  
\</SOAP-ENV:Body\>  
\</SOAP-ENV:Envelope\>

The same xml request is working on web browser but not in my software. Can I please know what im missing here or doing anything wrong?  
Thanks in advance

Cheers  
IP

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [November 22, 2016, 11:47am UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591/2 "2016-11-22T11:47:42Z")

</div>

The SOAPAction header is normally something like

SOAPAction=“[http://somedomain.com/something](http://somedomain.com/something)”

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [November 22, 2016, 11:48am UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591/3 "2016-11-22T11:48:35Z")

</div>

e.g.  
sock.SetRequestHeader(“SOAPAction”, “”“[http://somedomain.com/method](http://somedomain.com/method)”"")

but you find the exact thing to pass in the wsdl and normally you have to have it quoted.

---

<div class="post-metadata">

**Author:** ![isha\_parmar](https://forum.xojo.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@isha\_parmar](https://forum.xojo.com/u/isha_parmar)\
**Post date:** [November 22, 2016, 12:43pm UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591/4 "2016-11-22T12:43:12Z")

</div>

Thanks for the quick reply Christian , much appreciated!  
Unfortunately whatever the value of soapaction is in my wsdl if i’m trying to use the same, its also giving me error. My soapaction looks like this  
  
\<soap:binding transport=“[http://schemas.xmlsoap.org/soap/http](http://schemas.xmlsoap.org/soap/http)” style=“document”/\>  
  
\<soap:operation soapAction=“Multiplex.Method1Request@test@@” style=“document”/\>

So I have used  
sock.SetRequestHeader(“SOAPAction”, “”"“Multiplex.Method1Request@test@@”""")

and i’m getting following response  
XD[FAIL] cause: 77 subcause: 1 message: Failed loading agent test/Multiplex.ibs?wsdl: class not found

Can you please tell me what SOAPACTION value will be after seeing my wsdl information ?  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![Jean-Yves\_Pochez](https://forum.xojo.com/user_avatar/forum.xojo.com/jean-yves_pochez/32/21769_2.png) [@Jean-Yves\_Pochez](https://forum.xojo.com/u/Jean-Yves_Pochez)\
**Post date:** [November 22, 2016, 12:59pm UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591/5 "2016-11-22T12:59:31Z")

</div>

may be you should try to use Paw with the xojo code extensions ?

---

<div class="post-metadata">

**Author:** ![Jim\_Meyer](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/df788c/32.png) [@Jim\_Meyer](https://forum.xojo.com/u/Jim_Meyer)\
**Post date:** [November 22, 2016, 2:24pm UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591/6 "2016-11-22T14:24:31Z")

</div>

I do not think you need the line:

sock.SetRequestHeader(“SOAPAction”, “Method1”)

I also never assume that the response is going to be xml… if there is a problem on the server you might get html resulting in an exception when you load it into an xmldocument.

---

<div class="post-metadata">

**Author:** ![isha\_parmar](https://forum.xojo.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@isha\_parmar](https://forum.xojo.com/u/isha_parmar)\
**Post date:** [November 22, 2016, 2:32pm UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591/7 "2016-11-22T14:32:36Z")

</div>

Jean - Thank u so much, actually i’m just few months old to XOJO and no idea about PAW. Will look into this and get back if any success or failure.

James - Thank you so much for the reply  
If I do not need sock.SetRequestHeader(“SOAPAction”, “Method1”) , then is there any other way to specify which method/operation I wanted to call as there 4 sets of operations in the same WSDL and in my requirent i have to call one after another.  
Yes the response is string which i’m using it to create xmldocument.

Jean/james/Christian - Any pointers to SOAPAction value after seeing my wsdl  
  
\<soap:binding transport=“[http://schemas.xmlsoap.org/soap/http](http://schemas.xmlsoap.org/soap/http)” style=“document”/\>  
  
\<soap:operation soapAction=“Multiplex.Method1Request@test@@” style=“document”/\>

---

<div class="post-metadata">

**Author:** ![Jim\_Meyer](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/df788c/32.png) [@Jim\_Meyer](https://forum.xojo.com/u/Jim_Meyer)\
**Post date:** [November 22, 2016, 2:56pm UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591/8 "2016-11-22T14:56:02Z")

</div>

I specify the action inside the “” node… so my request in part looks like:  
…  
env:Body  
  
…  
  
\</env:Body\>  
…

---

<div class="post-metadata">

**Author:** ![isha\_parmar](https://forum.xojo.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@isha\_parmar](https://forum.xojo.com/u/isha_parmar)\
**Post date:** [November 22, 2016, 3:42pm UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591/9 "2016-11-22T15:42:38Z")

</div>

James  
for my request i’m also creating something similar which is working on SOAPUI  
\<soapenv:Envelope xmlns:soapenv=“[http://schemas.xmlsoap.org/soap/envelope/](http://schemas.xmlsoap.org/soap/envelope/)” xmlns:urn=“urn:schemas-iwaysoftware-com:iwse” xmlns:urn1=“urn:iwaysoftware:ibse:jul2003:Method1”\>  
soapenv:Body  
urn1:Method1  
\</urn1:Method1\>  
\</soapenv:Body\>  
\</soapenv:Envelope\>

But if I give same method name in xojo it gives me error  
sock.SetRequestHeader(“SOAPAction”, “Method1”)

incorrect structure of soapaction: Method1

And the wsdl of the same has sopaaction as  
  
\<soap:binding transport=“[http://schemas.xmlsoap.org/soap/http](http://schemas.xmlsoap.org/soap/http)” style=“document”/\>  
  
\<soap:operation soapAction=“Multiplex.Method1Request@test@@” style=“document”/\>

Totally confused what will be the value of soapaction in xojo

---

<div class="post-metadata">

**Author:** ![Jim\_Meyer](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/df788c/32.png) [@Jim\_Meyer](https://forum.xojo.com/u/Jim_Meyer)\
**Post date:** [November 22, 2016, 3:54pm UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591/10 "2016-11-22T15:54:00Z")

</div>

You might want to get a copy of Oxygen ([https://www.oxygenxml.com/xml\_editor/wsdl\_soap\_analyzer.html](https://www.oxygenxml.com/xml_editor/wsdl_soap_analyzer.html))… Its WSDL analyzer will give you exactly what you need to get it to work. It is not cheap but they have a 30 day free trial. I find it invaluable for not only SOAP but anything related to xml.

---

<div class="post-metadata">

**Author:** ![isha\_parmar](https://forum.xojo.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@isha\_parmar](https://forum.xojo.com/u/isha_parmar)\
**Post date:** [November 22, 2016, 4:31pm UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591/11 "2016-11-22T16:31:46Z")

</div>

Thanks James , I will try free trial first thing tomorrow morning.

---

<div class="post-metadata">

**Author:** ![isha\_parmar](https://forum.xojo.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@isha\_parmar](https://forum.xojo.com/u/isha_parmar)\
**Post date:** [November 23, 2016, 1:10pm UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591/12 "2016-11-23T13:10:40Z")

</div>

James Thanks for recommending Oxygen - it is very helpful to analyse wsdl  
its giving me all details of wsdl like URL, SOAP Action, Services, Ports, Operations  
I’m giving the same SOAPAction value but doesnot seem to work.  
In one of your previous answers you also mentioned that I don’t need sock.SetRequestHeader(“SOAPAction”, “Method1”)  
So ihave tried with  
responsestring = sock.SendRequest(“Method1”,Addresswsdl,20)  
and I got responsestring as 503 - Service Unavailable  
Looks like there URL is not accessible. I have sent email to third party to make URL available to me.  
Still trying my best to make it work 🙂

---

<div class="post-metadata">

**Author:** ![Jim\_Meyer](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/df788c/32.png) [@Jim\_Meyer](https://forum.xojo.com/u/Jim_Meyer)\
**Post date:** [November 23, 2016, 1:34pm UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591/13 "2016-11-23T13:34:47Z")

</div>

Is this a service I can access on my own? Can you send me a copy of the xml doc you are trying to send… along with the url and any other credentials?

---

<div class="post-metadata">

**Author:** ![isha\_parmar](https://forum.xojo.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@isha\_parmar](https://forum.xojo.com/u/isha_parmar)\
**Post date:** [November 23, 2016, 2:04pm UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591/14 "2016-11-23T14:04:05Z")

</div>

James is there a way I can send you a private message please ?

---

<div class="post-metadata">

**Author:** ![Jim\_Meyer](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/df788c/32.png) [@Jim\_Meyer](https://forum.xojo.com/u/Jim_Meyer)\
**Post date:** [November 23, 2016, 2:08pm UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591/15 "2016-11-23T14:08:50Z")

</div>

email to [info@varsitysystems.com](mailto:info@varsitysystems.com)

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 6:33pm UTC](https://forum.xojo.com/t/soap-webservice-xml-request-response-using-httpsocket/34591/16 "2020-10-29T18:33:38Z")

</div>


