Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
SOAP.WBT
;Here is what I finally figured out in making SOAP calls via WinBatch. Hope someone finds it useful. ;Jim Taylor 09/08/2005 SoapText = FileGet("C:\soap\soap_template.htm") wsurl = "http://soap.host.server/webservice?WSDL" ; WSDL File objXML = ObjectCreate("Microsoft.XMLHTTP") objXML.open("POST",wsurl,"False") objXML.setRequestHeader("Man", StrCat("POST ",wsurl," HTTP/1.1" ) objXML.setRequestHeader("MessageType", "CALL") objXML.setRequestHeader("Content-Type", "text/xml") objXML.setRequestHeader("SOAPAction", "Soap_Action") objXML.send(SoapText) ResponsePage = objXML.responseText ObjectClose(objXML) Message("HELLO. Here is your XML",ResponsePage) Exit
SOAPText TEMPLATE Example Most services will probably provide this Envelope information...but I may be wrong. The following is for informational/example purposes only. It won't work for any particular web service.
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <Enter_NameSpaceTarget xmlns="Enter_NameSpaceTarget"> <UPC></UPC> <CustomerAccount></CustomerAccount> <CustomerSubAccount></CustomerSubAccount> <LoginName></LoginName> <LoginPassword></LoginPassword> </Enter_NameSpaceTarget> </soap:Body> </soap:Envelope>Note: the script will error that 'no such service could be found'? Because I cannot provide the necessary information for the service for which I created this, for security reasons, but hopefully one can easily see the changes that need to be made. I think these would be the path to the SOAP Envelope(SoapText variable), WSDL File and enter the appropriate Soap Action.
;Winbatch - SOAP Demo with Web Service ; connect to service c_WSDL_URL = "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL" c_SERVICE = "CurrencyConvertor" c_PORT = "CurrencyConvertorSoap" c_SERVICE_NAMESPACE = "http://www.webserviceX.NET/" c_WSML = "" oSOAP = CreateObject("MSOSOAP.SoapClient30") oSOAP.MSSoapInit2(c_WSDL_URL, c_WSML, c_SERVICE, c_PORT, c_SERVICE_NAMESPACE) ;store variables for currency conversion cIn = "GBP" cOut = "USD" ;retval = ObjectType( "I4", 100.00 ) ;call Web Service Function retval = oSOAP.ConversionRate(cIn, cOut) oSOAP=0 Message( StrCat(cIn," to ",cOut),retval) Exit
;Winbatch 2011B - Get weather for airport (US only for now) ; HTTP GET from globalweather web service ; ;Stan Littlefield, Feb 3, 2013 ;////////////////////////////////////////////////////////////////////////////////////////////////////////// displayonly=0 ;Tests ;cCity='Seattle, Seattle Boeing Field' cCity='Raleigh / Durham, Raleigh-Durham International Airport' ;/////////////////////////////////////////////////////////////////////////////////////////////////////// cCountry='United States' cURL="http://www.webservicex.com/globalweather.asmx/GetWeather?CityName=%cCity%&CountryName=%cCountry%" oHTTP = CreateObject("WinHttp.WinHttpRequest.5.1") oHTTP.Open("GET", cURL, @FALSE) oHTTP.Send() oHTTP.WaitForResponse() cXML=oHTTP.ResponseText oHTTP=0 :xml cXML = StrReplace(cXML,"<","<") cXML = StrReplace(cXML,">",">") If displayonly Message("Weather", cXML) Else cFile=DirScript():"weatherXML.xml" FilePut(cFile,cXML) EndIf Exit
Article ID: W17239
File Created: 2013:02:11:09:26:26
Last Updated: 2013:02:11:09:26:26