SOAP WebService

Product :4D - 4D Server
4D : v13.2
OS : Windows
Estoy tratando de configurar un servidor SOAP WebService.

Pero me encuentro con un problema de “tipo complejo”.
Tenemos que dialogar (cliente y servidor en cada lado) con un tercero que requiere que usemos una estructura XML y nos proporcionó un WSDL.

Cuando realizó validación del Response utilizando el programa SoupUI, 4D genera automáticamente código adicional que no se como editar o eliminar.

Salida SoipUI
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle=“http://schemas.xmlsoap.org/soap/encoding/” xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:SOAP-ENC=“http://schemas.xmlsoap.org/soap/encoding/” xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”>
SOAP-ENV:Body
<ns1:consultarDeudaRequestResponse xmlns:ns1=“http://www.servipag.cl/ESB/schema/GenericService/Deuda/Consultar/Req-v2014.12”>

<soapenv:Envelope xmlns:soapenv=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:com=“http://www.servipag.cl/ESB/GenericService/Common” xmlns:resp=“http://www.servipag.cl/ESB/schema/GenericService/Deuda/Consultar/Resp-v2014.12”>
soapenv:Header/
soapenv:Body
resp:consultarDeudaResponse
resp:Identificador119</resp:Identificador1>
resp:IdTransaccion7845963221433423429312946</resp:IdTransaccion>
resp:Canal14</resp:Canal>
resp:Sucursal45698729</resp:Sucursal>
resp:Biller562</resp:Biller>
resp:CodigoServicio10000</resp:CodigoServicio>
resp:CodigoError11</resp:CodigoError>
resp:GlosaErrorCliente no existe.</resp:GlosaError>
resp:Documentos/
</resp:consultarDeudaResponse>
</soapenv:Body>
</soapenv:Envelope>

</ns1:consultarDeudaRequestResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Y salida que necesito

<soapenv:Envelope xmlns:soapenv=“http://schemas.xmlsoap.org/soap/envelope/"xmlns:com="http://www.servipag.cl/ESB/GenericService/Common” xmlns:resp=“http://www.servipag.cl/ESB/schema/GenericService/Deuda/Consultar/Resp-v2014.12”>
soapenv:Header/
soapenv:Body
resp:consultarDeudaResponse
resp:Identificador119</resp:Identificador1>
resp:IdTransaccion7845963221433423429312946</resp:IdTransaccion>
resp:Canal14</resp:Canal>
resp:Sucursal45698729</resp:Sucursal>
resp:Biller562</resp:Biller>
resp:CodigoServicio10000</resp:CodigoServicio>
resp:CodigoError11</resp:CodigoError>
resp:GlosaErrorCliente no existe.</resp:GlosaError>
resp:Documentos/
</resp:consultarDeudaResponse>
</soapenv:Body>
</soapenv:Envelope>

En el método del webService la variable de salida la estoy declarando de la siguiente manera;

SOAP DECLARATION(consultarDeudaResponse;Is XML;SOAP Output;“consultarDeudaResponse”)

También comprobé localmente como queda el archivo XML utilizando DOM EXPORT TO FILE($root;“archivo.xml”) y no aparecen ese código adicional al principio del archivo.

Hello,

I can try to help, but in english if you don’t mind…

Not sure to understand what you are trying to do. A SOAP client or a SOAP server ?
A SOAP server if I understand correctly.

So you use

SOAP DECLARATION(consultarDeudaResponse;Is XML;SOAP Output;“consultarDeudaResponse”)

and you end up sending this :

[]32540664;“Your comment here…”[/]

When you would like to send this :

[]32540670;“Your comment here…”[/]

Can you show us the code us have written before calling SOAP DECLARATION ?

It looks like you have tried to add the SOAP Envelope elements when this will be added by 4D so you end up inserting a SOAP Envelope within a SOAP Envelope…

HTH
Bruno

Hello Bruno,

My English is not very good but I will try to explain the code.

“It looks like you have tried to add the SOAP Envelope elements when this will be added by 4D so you end up inserting a SOAP Envelope within a SOAP Envelope… ” Yes, 4D automatically add SOAP-ENV:Envelope.

Create a method “consultarDeudaRequest” offered as Web Services and Publisched in WSDL

Declare input and output variables

//Input
SOAP DECLARATION(Identificador1;Is Text;SOAP Input;“Identificador1”)
SOAP DECLARATION(IdTransaccion;Is Text;SOAP Input;“IdTransaccion”)
SOAP DECLARATION(Canal;Is Integer;SOAP Input;“Canal”)
SOAP DECLARATION(Sucursal;Is String Var;SOAP Input;“Sucursal”)
SOAP DECLARATION(CodigoServicio;Is Integer;SOAP Input;“CodigoServicio”)

//Output
SOAP DECLARATION(consultarDeudaResponse;Is XML;SOAP Output;“consultarDeudaResponse”) //result in XML

//

//Created the XML structure with DOM

C_STRING(16;$root)
C_STRING(16;$subelem)
C_TEXT($namespace;$namespace1;$namespace2;$namespace3;$aNSNom1;$aNSNom2;$aNSNom3)

$raiz:=“soapenv:Envelope”
$namespace:=“http://schemas.xmlsoap.org/soap/envelope/
$aNSNom1:=“xmlns:resp”
$aNSNom2:=“xmlns:com”

$namespace1:=“http://www.servipag.cl/ESB/schema/GenericService/Deuda/Consultar/Resp-v2014.12
$namespace2:=“http://www.servipag.cl/ESB/GenericService/Common

$root:=DOM Create XML Ref($raiz;$namespace;$aNSNom1;$namespace1;$aNSNom2;$namespace2)

$vxPath:="/soapenv:Envelope"
$vxPath:=$vxPath+"/soapenv:Header"
$subelem:=DOM Create XML element($root;$vxPath)

$vxPath:="/soapenv:Envelope"
$vxPath:=$vxPath+"/soapenv:Body"
$subelem:=DOM Create XML element($root;$vxPath)
$root2:=$root
$vxPath:=$vxPath+"/resp:consultarDeudaResponse"
$subelem:=DOM Create XML element($root;$vxPath)

$vxPath2:=$vxPath

$subelem:=DOM Create XML element($root;$vxPath+"/resp:Identificador1")
DOM SET XML ELEMENT VALUE($subelem;Identificador1)

.
.
.
.
.
DOM EXPORT TO VAR($root;consultarDeudaResponse) // The created XML passed it to the SOAP output variable
DOM CLOSE XML($root)

When testing the published method in SoapUI, the version of the XML described in the first image appears.

I don’t know how to edit or delete those “SOAP-ENV: Envelope” elements that add 4D to the SOAP responses.

I do not know if it is feasible to receive the request through SOAP DECLARATION and the response via WEB SERVICE CALL.