AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Comunicación / SOAP
  • Properties specific to wsResponse variables
  • Operating mode
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
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.
Ejemplo
For a web service that returns 2 responses (and not a structured response)
wsResp is wsResponse = WSProcedure()
Trace(wsResp["part1"].subElement1)
Trace(wsResp["part2"].subElement2)
For a web service for which we want to retrieve the entire response XML (and the XML sent)
// WSDL of web service:
// http://www.webservicex.net/globalweather.asmx?WSDL

// Variable of parameter type of the web service function
paramGetWeather is GlobalWeather.GetWeather
paramGetWeather.CityName = "Paris-Charles De Gaulle Airport"
paramGetWeather.CountryName = "France"

// Variable of return type of the web service 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 web service function
wsResp is wsResponse
wsReq is wsRequest
// HTTP request timeout can be forced: example HTTPTimeOut(10*1000)
wsResp = GlobalWeather.GetWeather(wsReq,paramGetWeather)
IF ErrorOccurred THEN
	// You can retrieve all the XML returned with: wsRép.SourceXML
	Error(ErrorInfo(), ...
		"------------------- Details of the XML request sent: ", wsReq.XMLSource, ...
		"------------------- Details of the XML response received: ", wsRep.SourceXML)

ELSE
	// Then, assign the return type of the web service 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: " + xmlMeteo.CurrentWeather.Location, ...
			"Time: " + xmlMeteo.CurrentWeather.Time, ...
			"Wind: " + xmlMeteo.CurrentWeather.Wind, ...
			"Visibility: " + xmlMeteo.CurrentWeather.Visibility, ...
			"Temperature: " + xmlMeteo.CurrentWeather.Temperature, ...
			"DewPoint: " + xmlMeteo.CurrentWeather.DewPoint, ...
			"Humidity: " + xmlMeteo.CurrentWeather.RelativeHumidity, ...
			"Pressure: " + xmlMeteo.CurrentWeather.Pressure)
		ELSE
			Error(resGetWeatherResponse.GetWeatherResult, ...
 			"---------------------- Details of the XML response received:", wsRep.SourceXML)
		END
	END
END
Propiedades

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()
Observaciones

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:
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:
MyRequest..XMLSource
This feature may be useful during the design step and it is required to get some certifications.
Versión mínima requerida
  • Versión 18
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local