ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / SOAP
  • Properties specific to wsResponse variables
  • Operating mode
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
wsResponse (Type of variable)
In french: wsRéponse
The wsResponse type is used to get:
  • the XML source code of the Webservice response.
  • the value of the different parts of the Webservice response (for the Webservices returning several responses).
The characteristics of this type can be defined and changed using different WLanguage properties.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
For a Webservice that returns 2 responses (and not a structured response)
wsResp is wsResponse = WSProcedure()
Trace(wsResp["part1"].subElement1)
Trace(wsResp["part2"].subElement2)
For a Webservice for which we want to retrieve the entire response XML (and the XML sent)
// WSDL of Webservice:
// http://www.webservicex.net/globalweather.asmx?WSDL
 
// Variable of parameter type of the Webservice function
paramGetWeather is GlobalWeather.GetWeather
paramGetWeather.CityName = "Paris-Charles De Gaulle Airport"
paramGetWeather.CountryName = "France"
 
// Variable of return type of the Webservice function
resGetWeatherResponse is GetWeatherResponse
// Instead of:
// resGetWeatherResponse = GetWeather(paramGetWeather)
// Use a "wsResponse" variable to get the entire XML result and
// a "wsRequest" variable to retrieve everything that was sent to the Webservice function
wsResp is wsResponse
wsReq is wsRequest
// Ability to force the HTTP timeout of the request: example HTTPTimeOut(10*1000)
wsResp = GlobalWeather.GetWeather(wsReq,paramGetWeather)
IF ErrorOccurred THEN
// Ability to get the entire XML returned with: wsResp.XMLSource
Error(ErrorInfo(), ...
"---------------------------------- Details of the XML request sent: ", wsReq.SourceXML, ...
"---------------------------------- Details of the XML response received: ", wsResp.SourceXML)
 
ELSE
// Then, assign the return type of the Webservice function to the variable
resGetWeatherResponse=wsResp.Value
// If the result is not the expected one,
// you can get the entire XML result with wsResp.XMLSource
//trace(resGetWeatherResponse.GetWeatherResult..Value)
 
xmlWeather is xmlDocument = XMLOpen(resGetWeatherResponse.GetWeatherResult..Value, ...
fromString)
IF ErrorOccurred THEN
Error(ErrorInfo())
ELSE
IF xmlWeather.CurrentWeather.Status..Text~="Success" THEN
Info("City: " + xmlWeather.CurrentWeather.Location, ...
"Time: " + xmlWeather.CurrentWeather.Time, ...
"Wind: " + xmlWeather.CurrentWeather.Wind, ...
"Visibility: " + xmlWeather.CurrentWeather.Visibility, ...
"Temperature: " + xmlWeather.CurrentWeather.Temperature, ...
"Dew point: " + xmlWeather.CurrentWeather.DewPoint, ...
"Humidity: " + xmlWeather.CurrentWeather.RelativeHumidity, ...
"Pressure: " + xmlWeather.CurrentWeather.Pressure)
ELSE
Error(resGetWeatherResponse.GetWeatherResult, ...
"---------------------------------- Details of the XML response received:", wsResp.SourceXML)
END
END
END
Remarks

Properties specific to wsResponse variables

The following properties can be used to handle wsResponse variables:
Property nameType usedEffect
ResponsePartArrayUsed to get the XML code corresponding to the specified response.
You also have the ability to use the following notation:
Name_wsResponse_Variable["Response_name"]
This property is read-only.
ValueCharacter stringReturns the XML code corresponding to the first part of the response.
This property is read-only.
XMLSourceBinary/BufferXML source received from the server.
This property is read-only.

Caution: If the Webservice returns only one response, it is recommended to keep the following syntax:
res is ReturnType = WSProcedure()

Operating mode

The wsResponse type is used to get the XML source of the request sent for the consumption of the Webservice.
SOAPPrepare already gives the information for the general case but not when the Webservice requires:
Practically, the standard call to a function:
WebserviceResponse = WebserviceFunction(Param1, Param2)
can be replaced with:
MyRequest is wsRequest
WebserviceResponse = WebserviceFunction(MyRequest, Param1, Param2)
The entire XML source of the request can be included in a buffer via the following code:
MyRequest..XMLSource
This feature may be useful during the design step and it is required to get some certifications.
Minimum version required
  • Version 18
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/21/2023

Send a report | Local help