Hola leonardo daniel velazquez fuentes.
Tema aclarado entonces, con XmlHttpRequest de Velneo se pueden consultar Web Services WSDL/SOAP.
Te pongo un ejemplo sencillo.
Service web -> “http://www.webservicex.net/globalweather.asmx?WSDL”
Paquete SOAP -> “<soapenv:Envelope xmlns:soapenv=‘http://schemas.xmlsoap.org/soap/envelope/’ xmlns:web=‘http://www.webserviceX.NET’><soapenv:Header/><soapenv:Body><web:GetWeather><web:CityName>Madrid</web:CityName><web:CountryName>Spain</web:CountryName></web:GetWeather></soapenv:Body></soapenv:Envelope>”
Función: FUN_XHR_TIEMPO
Set ( XHR_URL, "http://www.webservicex.net/globalweather.asmx?WSDL" )
Set ( XHR_DATA, "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:web='http://www.webserviceX.NET'><soapenv:Header/
><soapenv:Body><web:GetWeather><web:CityName>Madrid</
web:CityName><web:CountryName>Spain</web:CountryName></web:GetWeather></
soapenv:Body></soapenv:Envelope>" )
Crear manejador de objeto ( oXML, Proceso PRO_XHR_TIEMPO_JS@0PS__MisFunciones_app )
Set variable local de objeto ( oXML, XHR_URL, XHR_URL )
Set variable local de objeto ( oXML, XHR_DATA, XHR_DATA )
Disparar objeto ( oXML, 1º plano: Local (síncrono), LOK )
Libre
Get variable local de objeto ( oXML, XHR_SALIDA_XML, XHR_SALIDA_XML )
Get variable local de objeto ( oXML, _NERROR, _NERROR )
Get variable local de objeto ( oXML, _NSTATUS, _NSTATUS )
Libre
Rem ( Mensaje de Error )
If ( _NERROR > 0 )
Mensaje ( "Se ha producido un error " + numberToString(_NERROR, "L", 0) + " del objeto
XmlHttpRequest. Código HTTP devuelto en el Response: " + numberToString(_NSTATUS, "L", 0),
Información, , )
Set dato de retorno ( "" )
Else
Set ( XHR_SALIDA_XML, replaceString(replaceString(XHR_SALIDA_XML, "<", "<"), ">", ">") )
Mensaje ( "Resultado XML:\n\n" + XHR_SALIDA_XML, Información, , )
Set dato de retorno ( XHR_SALIDA_XML )
Libre
Proceso JavaScript PRO_XHR_TIEMPO_JS
importClass("XMLHttpRequest");
// URL de acceso al web service
var cURL = theRoot.varToString("XHR_URL")
// ASÍNCRONO. Asincrono no
var lAsincrono = false
// LOGIN del método Open()
var cUsuario = "", cClave = ""
// INSTANCIAR XHR. Instanciamos el objeto XmlHttpRequest
var xhr = new XMLHttpRequest()
// TIMEOUT
xhr.timeout = 15000
// STRING. Tipo del Response texto
xhr.responseType = ""
// OPEN. Abrimos la conexión
xhr.open("POST", cURL, lAsincrono, cUsuario, cClave);
// CABECERAS. Indicamos al servidor que los datos del POST están en formato XML
xhr.setRequestHeader("Content-Type", "text/xml;charset=utf-8")
// SEND. Enviamos el paquete SOAP xml
var cDatos = theRoot.varToString("XHR_DATA")
xhr.send(cDatos)
// XML. Recogemos el resultado
theRoot.setVar("XHR_SALIDA_XML", xhr.response)
theRoot.setVar("_NERROR", xhr.errorCode) // Código de error Ver lista en el API de Velneo
theRoot.setVar("_NSTATUS", xhr.status) // Código HTTP del resultado 200=OK, otros 20X, 40X, 50X
Obtienes un string XML que tendrás que parsear con alguna herramienta externa a Velneo o usar funciones de cadena nativas.
Por supuesto, si el XML es muy complejo mejor una DLL de pago para obtener resultados fiables.
En este ejemplo he usado las funciones que venían en la Open App vUtiles (ver adjunto).
Saludos
Paco Satué