PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • 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/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 modified using different WLanguage properties.
Remark: See Declaring a variable for more details on the declaration of this type of variable and the use of WLanguage properties.
Versions 25 and later
Android This type of variable is now available for Android applications.
New in version 25
Android This type of variable is now available for Android applications.
Android This type of variable is now available for Android applications.
Example
For a Webservice that returns 2 responses (and not a structured response)
wsRep is wsResponse = WSProcedure()
Trace(wsRep["partie1"].sousElement1)
Trace(wsRep["partie2"].sousElement2)
For a Webservice for which we want to retrieve the entire response XML (and the XML sent)
// WSDL du Webservice:
// http://www.webservicex.net/globalweather.asmx?WSDL
 
// Variable du type du paramètre de la fonction du Webservice
paramGetWeather is GlobalWeather.GetWeather
paramGetWeather.CityName = "Paris-Aeroport Charles De Gaulle"
paramGetWeather.CountryName = "France"
 
// Variable du type de retour de la fonction du Webservice
resGetWeatherResponse is GetWeatherResponse
// Au lieu de faire:
// resGetWeatherResponse = GetWeather(paramGetWeather)
// Utilisation d'une variable "wsRéponse" pour récupérer tout le XML résultat et
// une variable "wsRequête" pour récupérer tout ce qui a été envoyé à la fonction du Webservice
wsRep is wsResponse
wsReq is wsRequest
// Possible de forcer le timeout HTTP de la requête: exemple HTTPTimeOut(10*1000)
wsRep = GlobalWeather.GetWeather(wsReq,paramGetWeather)
IF ErrorOccurred THEN
// Il est possible de récupérer tout le XML renvoyé avec: wsRép.SourceXML
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
// Puis affectation à la variable du type de retour de la fonction du Webservice
resGetWeatherResponse=wsRep.Value
// Si le résultat n'est pas celui attendu,
// il est possible d'avoir tout le XML résultat avec wsRép.SourceXML
//trace(resGetWeatherResponse.GetWeatherResult..Valeur)
 
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
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:
Nom_Variable_wsRéponse["Nom_de_la_réponse"]
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 est un TypeRetour = WSProcédure()

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:
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 request can be included in a buffer via the following code:
MaRequete..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