|
|
|
|
- Properties specific to wsResponse variables
- Operating mode
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.
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 name | Type used | Effect |
---|
ResponsePart | Array | Used 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. | Value | Character string | Returns the XML code corresponding to the first part of the response. This property is read-only. | XMLSource | Binary/Buffer | XML 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: This feature may be useful during the design step and it is required to get some certifications.
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|