ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Communication / SOAP
  • Properties specific to wsResponse variables
  • Operating mode
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
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.
Example
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)
// 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
Properties

Properties specific to wsResponse variables

The following properties can be used to define the characteristics of 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.

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:
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

Last update: 03/27/2025

Send a report | Local help