Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > Web services response validation

Forum

Search UsersRules
Web services response validation
#1
Interested
Points:: 15
Joined:: Oct 27, 2011

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.

Profile
#2
Interested
Points:: 0
Joined:: Dec 4, 2017

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

Profile
#3
Interested
Points:: 15
Joined:: Oct 27, 2011

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

Profile
#4
Interested
Points:: 0
Joined:: Dec 4, 2017

Dear Alexey,

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

Best regards,
Vladimir Gurov

Profile
#5
Active user
Points:: 0
Joined:: Apr 18, 2012

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.

Profile
#6
Interested
Points:: 0
Joined:: Dec 4, 2017

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

Profile
#7
Interested
Points:: 15
Joined:: Oct 27, 2011

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.

Profile
#8
Interested
Points:: 0
Joined:: Dec 4, 2017

Dear Alexey,

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

Best regards,
Vladimir Gurov

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.