Hi,
I should communicate with a external Webservice via WSDL->SOAP
I got Service-Description - see enclosed files - but I've now idea how to realize that.
Is there an - ahk - example available or another example in a higher language for a SOAP imlementation ??
regards
J.M.
WSDL .. Communication with Webservice via SOAP
WSDL .. Communication with Webservice via SOAP
AHK: 1.1.37.01 Ansi, 32-Bit; Win10 22H2 64 bit, german
Re: WSDL .. Communication with Webservice via SOAP
It depends on what the platform is I should think. We used something like this for a help desk that ran on Siebel.
Code: Select all
xml =
(
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://SR_LIB/INVOKE" xmlns:ser="http://www.siebel.com/xml/Service%20Request%20Detail%20CHD%20CERN">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>%SRWebServiceUsername%</wsse:Username>
<wsse:Password>%SRWebServicePassword%</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<inv:Query_V4>
<ComplexSearchSpec xmlns="">%complexSearchSpec%</ComplexSearchSpec>
</inv:Query_V4>
</soapenv:Body>
</soapenv:Envelope>
)
response := SRWebService_SendRequest(xml, environment, "SRApp")
;Send the XML string request and returns an XML object of the SOAP Body
SRWebService_SendRequest(xml, environment, serviceType)
{
host =
endpoint =
namespaces =
if (environment = "PROD")
host := <your host>
if (serviceType = "SRApp")
{
endpoint := "https://" . host . "/SRWeb/sca/INVOKE"
namespaces := "xmlns:in=""http://SR_LIB/INVOKE"""
}
else if (serviceType = "ODS")
{
endpoint := "https://" . host . "/ODS_SRWeb/sca/INVOKE"
namespaces := "xmlns:in=""http://ODS_SR_LIB/INVOKE"""
}
else if (serviceType = "Attachment")
{
endpoint := "https://" . host . "/SBL_SRAttachmentWeb/sca/Invoke"
namespaces := "xmlns:in=""http://SBL_SRAttachment_Lib/Invoke"""
}
else if (serviceType = "Contact")
{
endpoint := "https://" . host . "/SBL_ContactWidgetWeb/sca/Invoke"
namespaces := "xmlns:in=""http://SBL_ContactWidget_Lib/Invoke"" xmlns:v3=""<your service>"" xmlns:v3_1=""http://www.siebel.com/xml/Contact"""
}
else
{
msgbox, Error calling SR web service: Invalid service type
return
}
Response := []
WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
WebRequest.Open("POST", endpoint)
WebRequest.SetRequestHeader("Accept", "*/*")
WebRequest.SetRequestHeader("Accept-Language", "en-us")
WebRequest.SetRequestHeader("Accept-Encoding", "gzip, deflate")
WebRequest.SetRequestHeader("Content-Type", "text/xml; charset=utf-8")
WebRequest.SetRequestHeader("Content-Length", StrLen(xml))
WebRequest.SetRequestHeader("SOAPAction", endpoint)
WebRequest.SetRequestHeader("Host", host)
WebRequest.SetRequestHeader("Connection", "Keep-Alive")
WebRequest.SetTimeouts(180000,180000,180000,180000)
try
WebRequest.Send(xml)
catch
return
Response["Text"] := WebRequest.ResponseText
WebRequest := ""
;Put the XML content into an object
doc := ComObjCreate("MSXML2.DOMDocument.6.0")
doc.async := false
doc.loadXML(Response["Text"])
doc.setProperty("SelectionNamespaces", namespaces . " xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""")
body := doc.selectSingleNode("soapenv:Envelope").selectSingleNode("soapenv:Body")
return body
}
Re: WSDL .. Communication with Webservice via SOAP
Hi,
thanks, that helps me a lot .. I'll try it with my webservice.
Inbetween I learned to know that
# there is a tool called SoapUI.org (free) to test and develop Soap-Requests against a webservice, very helpfull to see xml-syntax of soap-requests
# I could do some tests against a webservice on http://www.webservicex.net/globalweather.asmx (free)
Therewith I did my first tests with Soap-Statements in XML-Files and sent them via curl.exe - worked.
regards
J.M.
thanks, that helps me a lot .. I'll try it with my webservice.
Inbetween I learned to know that
# there is a tool called SoapUI.org (free) to test and develop Soap-Requests against a webservice, very helpfull to see xml-syntax of soap-requests
# I could do some tests against a webservice on http://www.webservicex.net/globalweather.asmx (free)
Therewith I did my first tests with Soap-Statements in XML-Files and sent them via curl.exe - worked.
regards
J.M.
AHK: 1.1.37.01 Ansi, 32-Bit; Win10 22H2 64 bit, german
Re: WSDL .. Communication with Webservice via SOAP
Very cool. Good info too. Thanks for sharing.
Re: WSDL .. Communication with Webservice via SOAP
Hi,
for those who are interested:
A) this curl.exe-call (a batch):
B) with that input-xml-file (named: weather_output1.xml):
C) generates and outputfile which is named "output1.xml" and it contains Requested results - it works, try it.
Regards
J.M.
for those who are interested:
A) this curl.exe-call (a batch):
Code: Select all
curl -H "Content-Type: application/soap+xml" -d "@weather_output1.xml" "http://www.webservicex.net/globalweather.asmx" > output1.xml
Code: Select all
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://www.webserviceX.NET">
<soap:Header/>
<soap:Body>
<web:GetCitiesByCountry>
<!--Optional:-->
<web:CountryName>Austria</web:CountryName>
</web:GetCitiesByCountry>
</soap:Body>
</soap:Envelope>
Regards
J.M.
AHK: 1.1.37.01 Ansi, 32-Bit; Win10 22H2 64 bit, german
Re: WSDL .. Communication with Webservice via SOAP
Hi @Jovannb can you explain little your code.
Where is curl.exe and how your full code looks like?
Thank you
Where is curl.exe and how your full code looks like?
Thank you
Re: WSDL .. Communication with Webservice via SOAP
Hi,
Curl is available here: https://curl.haxx.se/windows/.
Thats an example and nothing else.
a) i call that "curl ... " line by ahk
b) get that resultfile (output1.xml)
to think that further you can generate that certain input-file (weather_output1.xml) programmatically by ahk and you can analyse what you get back (output1.xml) by ahk too.
J.B.
Curl is available here: https://curl.haxx.se/windows/.
Thats an example and nothing else.
a) i call that "curl ... " line by ahk
b) get that resultfile (output1.xml)
to think that further you can generate that certain input-file (weather_output1.xml) programmatically by ahk and you can analyse what you get back (output1.xml) by ahk too.
J.B.
AHK: 1.1.37.01 Ansi, 32-Bit; Win10 22H2 64 bit, german
Re: WSDL .. Communication with Webservice via SOAP
Hi @Jovannb ,
I have data from
Can you help me with that?
I have data from
and xml code is
Code: Select all
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:GetItem>
<!--Optional:-->
<tem:ItemNo>0011</tem:ItemNo>
</tem:GetItem>
</soapenv:Body>
</soapenv:Envelope>
Re: WSDL .. Communication with Webservice via SOAP
a) I cant believe, that your system uses TCP-Port "...:123/...." as shown above.blue83 wrote: ↑09 Mar 2020, 03:05Hi @Jovannb ,
I have data fromand xml code is
Can you help me with that?Code: Select all
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/"> <soapenv:Header/> <soapenv:Body> <tem:GetItem> <!--Optional:--> <tem:ItemNo>0011</tem:ItemNo> </tem:GetItem> </soapenv:Body> </soapenv:Envelope>
b) Without any definition what that webservice expects to get asked (in which syntax), it is impossible to say whether your XML-request works or not.
J.B.
AHK: 1.1.37.01 Ansi, 32-Bit; Win10 22H2 64 bit, german
Re: WSDL .. Communication with Webservice via SOAP
acctually is 85 instead of 123, only word "example in link is different.
so link is
so link is
Re: WSDL .. Communication with Webservice via SOAP
I assume, that this is link is still an example and nothing else, from my perspective, there is nothing to reach behind.
Please search for documentation for that certain WSDL-Service via google.
As soon as you find/you have a description, it is possible to help you maybe
J.B.
AHK: 1.1.37.01 Ansi, 32-Bit; Win10 22H2 64 bit, german
Who is online
Users browsing this forum: No registered users and 335 guests