PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Properties specific to the description of wsResponse variables
  • Operating mode
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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 modified by several WLanguage properties.
Note: See Declaring a variable for more details.
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 time-out of the request: example HTTPTimeOut(10*1000)
wsResp = GlobalWeather.GetWeather(wsReq,paramGetWeather)
IF ErrorOccurred THEN
// Ability to get the entire XML returned with: wsResp.SourceXML
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 have the ability to get the entire result XML with wsResp.SourceXML
//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 the description of wsResponse variables

The following properties can be used to handle a wsResponse variable:
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 available in read-only.
XMLSourceBinary/BufferXML source received from the server.
This property is available in read-only.
ValueCharacter stringReturns the XML code corresponding to the first part of the response.
This property is available in read-only.
Caution: If the Webservice ne returns a single response, we recommend that you keep the following syntax:
res is ReturnType = WSProcedure()
Note: These properties can be used with one of the following syntaxes:
  • <Variable Name>..<Property Name>
  • <Variable Name>.<Property Name>

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 by:
MyRequest is wsRequest
WebserviceResponse = WebserviceFunction(MyRequest, Param1, Param2)
The entire XML source of 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 required version
  • Version 18
This page is also available for…
Comments
Click [Add] to post a comment