PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Running a procedure on a SOAP server
SOAPRunXML (Example)
Running a procedure on a SOAP server
The following code is used to run a procedure on a SOAP server. This procedure, named "getTemp", returns the temperature of a city identified by its zip code.
// Define the variables
MessageXML is string
ResExecute is boolean

// Define the XML message of the "getTemp" procedure that
// returns the temperature of a city identified by its zip code
MessageXML = ...
"<SOAP-ENV:Envelope xmlns:SOAP-ENV="+ ...
"http://schemas.xmlsoap.org/soap/envelope/"+...
"xmlns:xsi=""http://www.w3.org/1999/XMLSchema-instance"""+ ...
"xmlns:xsd=""http://www.w3.org/1999/XMLSchema"">"+ ...
"SOAP-ENV:Body> "+...
"<ns1:getTemp xmlns:ns1=""urn:xmethods-Temperature"" SOAP-"+ ...
"ENV:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/"">"+ ...
"<zipcode xsi:type=""xsd:string"">94041</zipcode> "+ ...
"</ns1:getTemp> "+ ...
"</SOAP-ENV:Body> "+ ...
"</SOAP-ENV:Envelope>"

// Run the "getTemp" procedure
ResExecute = SOAPRunXML("http://services.xmethods.net:80"+ ...
  "/soap/servlet/rpcrouter", MessageXML)

// Is the communication with the server successful?
IF ResExecute = True THEN
// Is the procedure successfully run?
IF SOAPGetResult(SOAPResult) <> "" THEN
// Display the result returned by the procedure
  Info("The temperature is: " + SOAPGetResult(SOAPResult))
ELSE
  // Display the error returned by the SOAP server
  Error(SOAPError(SOAPErrMessage))
END
ELSE
  Error(ErrorInfo(errMessage))
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment