|
|
|
|
|
- Properties specific to wsResponse variables
- Operating mode
wsResponse (Variable type) In french: wsRéponse
The wsResponse type is used to get: - the XML source code of the web service response.
- the value of the different parts of the web service response (for the web services returning several responses).
You can define and change the characteristics of this type using different WLanguage properties. Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
For a web service that returns 2 responses (and not a structured response) wsRep is wsResponse = WSProcedure()
Trace(wsRep["partie1"].sousElement1)
Trace(wsRep["partie2"].sousElement2)
For a web service for which we want to retrieve the entire response XML (and the XML sent)
paramGetWeather is GlobalWeather.GetWeather
paramGetWeather.CityName = "Paris-Aeroport Charles De Gaulle"
paramGetWeather.CountryName = "France"
resGetWeatherResponse is GetWeatherResponse
wsRep is wsResponse
wsReq is wsRequest
wsRep = GlobalWeather.GetWeather(wsReq,paramGetWeather)
IF ErrorOccurred THEN
Error(ErrorInfo(), ...
"------------------- Détails de la requête XML envoyée : ", wsReq.XMLSource, ...
"------------------- Détails de la réponse XML reçue : ", wsRep.XMLSource)
ELSE
resGetWeatherResponse=wsRep.Value
xmlMeteo is xmlDocument = XMLOpen(resGetWeatherResponse.GetWeatherResult..Value, ...
fromString)
IF ErrorOccurred THEN
Error(ErrorInfo())
ELSE
IF xmlMeteo.CurrentWeather.Status..Text~="Success" THEN
Info("Ville : " + xmlMeteo.CurrentWeather.Location, ...
"Heure : " + xmlMeteo.CurrentWeather.Time, ...
"Vent : " + xmlMeteo.CurrentWeather.Wind, ...
"Visibilité : " + xmlMeteo.CurrentWeather.Visibility, ...
"Température : " + xmlMeteo.CurrentWeather.Temperature, ...
"Point de rosée : " + xmlMeteo.CurrentWeather.DewPoint, ...
"Humidité : " + xmlMeteo.CurrentWeather.RelativeHumidity, ...
"Pression : " + xmlMeteo.CurrentWeather.Pressure)
ELSE
Error(resGetWeatherResponse.GetWeatherResult, ...
"---------------------- Détails de la réponse XML reçue :", wsRep.XMLSource)
END
END
END
Properties Properties specific to wsResponse variables The following properties can be used to define the characteristics of 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. |
Warning: If the web service returns only one response, it is advisable to use the following syntax: res is ReturnType = WSProcedure() Remarks Operating mode The wsResponse type is used to get the XML source of the request sent for the consumption of the web service. SOAPPrepare already gives the information for the general case but not when the web service requires: Practically, the standard call to a function: RéponseWebservice = FonctionWebservice(Param1, Param2)
can be replaced with: MaRequête is wsRequest
RéponseWebservice = FonctionWebservice(MaRequête, 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…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|