WSDL .. Communication with Webservice via SOAP

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Jovannb
Posts: 256
Joined: 17 Jun 2014, 02:44
Location: Austria

WSDL .. Communication with Webservice via SOAP

12 Jan 2016, 10:46

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.
Attachments
2016-01-12_163522.jpg
WSDL-Definition2
2016-01-12_163534.jpg
WSDL-Definition1
AHK: 1.1.33.01 Ansi, 32-Bit; Win10 (2004, 19041.685) 64 bit, german
User avatar
kczx3
Posts: 1253
Joined: 06 Oct 2015, 21:39

Re: WSDL .. Communication with Webservice via SOAP

13 Jan 2016, 08:14

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
	
}
User avatar
Jovannb
Posts: 256
Joined: 17 Jun 2014, 02:44
Location: Austria

Re: WSDL .. Communication with Webservice via SOAP

13 Jan 2016, 08:30

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.
AHK: 1.1.33.01 Ansi, 32-Bit; Win10 (2004, 19041.685) 64 bit, german
User avatar
kczx3
Posts: 1253
Joined: 06 Oct 2015, 21:39

Re: WSDL .. Communication with Webservice via SOAP

13 Jan 2016, 08:33

Very cool. Good info too. Thanks for sharing.
User avatar
Jovannb
Posts: 256
Joined: 17 Jun 2014, 02:44
Location: Austria

Re: WSDL .. Communication with Webservice via SOAP

13 Jan 2016, 08:51

Hi,

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
B) with that input-xml-file (named: weather_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>
C) generates and outputfile which is named "output1.xml" and it contains Requested results - it works, try it.

Regards

J.M.
AHK: 1.1.33.01 Ansi, 32-Bit; Win10 (2004, 19041.685) 64 bit, german
blue83
Posts: 143
Joined: 11 Apr 2018, 06:38

Re: WSDL .. Communication with Webservice via SOAP

07 Mar 2020, 19:13

Hi @Jovannb can you explain little your code.

Where is curl.exe and how your full code looks like?

Thank you
User avatar
Jovannb
Posts: 256
Joined: 17 Jun 2014, 02:44
Location: Austria

Re: WSDL .. Communication with Webservice via SOAP

08 Mar 2020, 12:18

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.
AHK: 1.1.33.01 Ansi, 32-Bit; Win10 (2004, 19041.685) 64 bit, german
blue83
Posts: 143
Joined: 11 Apr 2018, 06:38

Re: WSDL .. Communication with Webservice via SOAP

09 Mar 2020, 03:05

Hi @Jovannb ,

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>
Can you help me with that?
User avatar
Jovannb
Posts: 256
Joined: 17 Jun 2014, 02:44
Location: Austria

Re: WSDL .. Communication with Webservice via SOAP

09 Mar 2020, 03:42

blue83 wrote:
09 Mar 2020, 03:05
Hi @Jovannb ,

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>
Can you help me with that?
a) I cant believe, that your system uses TCP-Port "...:123/...." as shown above.
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.33.01 Ansi, 32-Bit; Win10 (2004, 19041.685) 64 bit, german
blue83
Posts: 143
Joined: 11 Apr 2018, 06:38

Re: WSDL .. Communication with Webservice via SOAP

09 Mar 2020, 04:46

acctually is 85 instead of 123, only word "example in link is different.

so link is
User avatar
Jovannb
Posts: 256
Joined: 17 Jun 2014, 02:44
Location: Austria

Re: WSDL .. Communication with Webservice via SOAP

09 Mar 2020, 04:56

blue83 wrote:
09 Mar 2020, 04:46
acctually is 85 instead of 123, only word "example in link is different.

so link is
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.33.01 Ansi, 32-Bit; Win10 (2004, 19041.685) 64 bit, german

Return to “Ask For Help”

Who is online

Users browsing this forum: boiler, djuga, PuzzledGreatly and 44 guests