SOAP Webservice XML request/response using HTTPSocket

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/“>
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

The SOAPAction header is normally something like

SOAPAction=“http://somedomain.com/something

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

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

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” 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

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

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.

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” style=“document”/>

<soap:operation soapAction=“Multiplex.Method1Request@test@@” style=“document”/>

I specify the action inside the “” node… so my request in part looks like:

env:Body



</env:Body>

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/” 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” style=“document”/>

<soap:operation soapAction=“Multiplex.Method1Request@test@@” style=“document”/>

Totally confused what will be the value of soapaction in xojo

You might want to get a copy of Oxygen (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.

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

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 :slight_smile:

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?

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

email to info@varsitysystems.com