Web services response validation



The 1C:Enterprise developers forum

#1
People who like this:0Yes/0No
Interested
Rating: 32
Joined: Oct 27, 2011
Company: Abaco Soluciones S.A.

I have noticed that 1c WS implememation does not work with a lot of web services published. I have tried to make it work all the way from 8.3.6 until now.
I have prepared and example to test

Code
&AtServer
Procedure TestSOAPAtServer()
   Clave = "1801201801099271313500120010020000004247142553011";
   SSL = New OpenSSLSecureConnection();
   WSD = New WSDefinitions("https://cel.sri.gob.ec/comprobantes-electronicos-ws/AutorizacionComprobantesOffline?wsdl",,,,,SSL); 
   WSProxy = New WSProxy(WSD,"http://ec.gob.sri.ws.autorizacion",
      "AutorizacionComprobantesOfflineService",
      "AutorizacionComprobantesOfflinePort",,15,
      SSL);   
   Response = WsProxy.autorizacionComprobante(Clave);
EndProcedure


As you can imagine, it fails. And there is no way I can ask my service provider to make any changes to the publication, because it works just fine with java, c# and other applications.

Quote
{DataProcessor.Consultar.Form.Form.Form(156)}: Error calling context method (autorizacionComprobante)
Response = WsProxy.autorizacionComprobante(Clave);
, reason:
Web service call error. Service operation call error: {http://ec.gob.sri.ws.autorizacion}:AutorizacionComprobantesOfflineService:autorizacionComprobante()
, reason:
Web service call error. Unknown error. Error converting XDTO data:
Read object of type - [1,503]
Additional property validation:
form: Item
name: autorizacion
, reason:
Error converting XDTO data:
Read object of type - [1,503]
Additional property validation:
form: Item
name: autorizacion
, reason:
XDTO data validation error:
Object structure does not match type:

Is there any way to make it work without manually parsing XML? Actually I have already created a library to replase 1C SOAP services, but it does not seems to be the rihgt way to proceed. I am really hoping it could be done by using standard functions and objects.

 
#2
People who like this:0Yes/1No
Administrator
Rating: 14
Joined: Dec 4, 2017
Company:

Dear Alexey,

To help you investigate and resolve the issue, we need to take a look at the contents of the web service response you obtained.

Could you please record and send us the network traffic of the operation you try to perform via the web service - for instance, with Wireshark?

Best regards,
Vladimir Gurov

1C Company support team
 
#3
People who like this:0Yes/0No
Interested
Rating: 32
Joined: Oct 27, 2011
Company: Abaco Soluciones S.A.

Vladimir, I have posted complete example so you can just copy theese lines, paste them and investigate the problem.

 
#4
People who like this:0Yes/0No
Administrator
Rating: 14
Joined: Dec 4, 2017
Company:

Dear Alexey,

We are still investigating the issue and will return with results soon.

Best regards,
Vladimir Gurov

1C Company support team
 
#5
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Apr 18, 2012
Company:

Hi, Alexei.

I executed your code and it failed. Then I tried to run request at http://www.soapclient.com/soaptest.html and it failed too.

Code
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:autorizacionComprobanteResponse xmlns:ns2="http://ec.gob.sri.ws.autorizacion">
<RespuestaAutorizacionComprobante>
<claveAccesoConsultada/>
<autorizaciones>
<autorizacion>
<estado>RECHAZADA</estado>
<mensajes>
<mensaje>
<identificador>80</identificador>
<mensaje>ERROR EN LA ESTRUCTURA DE LA CLAVE DE ACCESO</mensaje>
</mensaje>
</mensajes>
</autorizacion>
</autorizaciones>
</RespuestaAutorizacionComprobante>
</ns2:autorizacionComprobanteResponse>
</soap:Body>
</soap:Envelope>


ERROR IN THE STRUCTURE OF THE ACCESS KEY

I think something wrong with "Clave".

So 1C doesn't work wrong, but it would be very useful to show plain response in the error message instead "Error converting XDTO data". Wireshark for such small problem - it's overkill.

 
#6
People who like this:0Yes/0No
Administrator
Rating: 14
Joined: Dec 4, 2017
Company:

Dear Alexey,

We tested the web service via SoapUI and it successfully returns an XML-formatted response.

The issue with 1C:Enterprise script code you provided is that at the moment the XDTO library incorrectly processes the contents of the response's "ambiente" XML element (this contents is encoded in CDATA and has XML format).

Our developers will either provide a fix for the issue in the next version of 1C:Enterprise platform, or provide you with a workaround to let you work with the web service from your 1C:Enterprise script code.

Best regards,
Vladimir Gurov

1C Company support team
 
#7
People who like this:0Yes/0No
Interested
Rating: 32
Joined: Oct 27, 2011
Company: Abaco Soluciones S.A.

Quote
Vladimir Gurov wrote:
Our developers will either provide a fix for the issue in the next version of 1C:Enterprise platform, or provide you with a workaround to let you work with the web service from your 1C:Enterprise script code.

It definitely needs to be fixed, because every time I was trying to adapt XDTO it fails on me. Also, please suggest some workaround until it will be fixed. I have made a xml manually and changed the content variables. but it does not look as a sleek solution.

 
#8
People who like this:0Yes/0No
Administrator
Rating: 14
Joined: Dec 4, 2017
Company:

Dear Alexey,

Currently, there is no known workaround for the issue. We have to wait for the fix.

Best regards,
Vladimir Gurov

1C Company support team
 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)