Página 2 de 3 PrimerPrimer 1 2 3 ÚltimoÚltimo
Resultados 11 al 20 de 23

Tema: Ligar ao Site da União Europeia VAT Number

  1. #11
      Administrador
    Avatar de Kuk

    Registrado
    enero de 2015
    Ubicación
    Madrid
    Edad
    39
    Mensajes
    2,294
    Última visita
    17.05.2024

    Agradecimientos
     
    Recibidos
    1,040
    Enviados
    888

    Citaciones y menciones
     
    Mentioned
    106 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    31 Post(s)
    Poder de Reputación
    10

    Predeterminado

    @Joseg, acabo de probar con https https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl y funciona con SoapUI 2.5.1
    Imagem Anexada Imagem Anexada

    0 Not allowed!
    ¿Te han ayudado? NO TE OLVIDES de darle al botón
    ¿Quieres dirigirte a alguien en tu post? Notifícale con una mención, tienes 2 opciones:
    1. Haciendo clic en el icono al lado de su nick
    2. Haciendo clic en el botón en el editor y escribiendo su nick.

  2. #12
      Senior
    Avatar de fastpho

    Registrado
    diciembre de 2016
    Ubicación
    Mendoza
    Edad
    53
    Mensajes
    326
    Última visita
    18.04.2024

    Agradecimientos
     
    Recibidos
    226
    Enviados
    209

    Citaciones y menciones
     
    Mentioned
    49 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    15 Post(s)
    Poder de Reputación
    21
    Innovación / Point Value: 0 Concurso: Primer puesto / Point Value: 0

    Predeterminado

    Cita Iniciado por Joseg Ver Mensaje
    Nesta linha:
    COBOL Código:
    1. INVOKE WEBSERVICE "get-Responsetext" RETURNING RESPOSTA.

    "RESPOSTA" é a seguinte:
    XML Código:
    1. <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>The given SOAPAction
    2.  Content-Type does not match an operation.</faultstring></soap:Fault></soap:Body></soap:Envelope>
    Hola @Joseg, El problema esta en el dato de envio es invalido, estuve probando el ejemplo original de RUI , y le falta el cierre de
    XML Código:
    1. </tns1:checkVat>
    agregando esta linea a la variable de envio Traffic-Conditions funciona bien ....
    Me trajo los datos correctos
    Saludos..

    0 Not allowed!

  3. #13
      Administrador
    Avatar de Kuk

    Registrado
    enero de 2015
    Ubicación
    Madrid
    Edad
    39
    Mensajes
    2,294
    Última visita
    17.05.2024

    Agradecimientos
     
    Recibidos
    1,040
    Enviados
    888

    Citaciones y menciones
     
    Mentioned
    106 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    31 Post(s)
    Poder de Reputación
    10

    Predeterminado

    @fastpho, bien visto compañero

    Yo utilicé el WSDL original con el SoapUI y será por eso que me funcionó.

    Lo raro es que antes haya funcionado...

    0 Not allowed!
    ¿Te han ayudado? NO TE OLVIDES de darle al botón
    ¿Quieres dirigirte a alguien en tu post? Notifícale con una mención, tienes 2 opciones:
    1. Haciendo clic en el icono al lado de su nick
    2. Haciendo clic en el botón en el editor y escribiendo su nick.

  4. #14
      Senior
    Avatar de fastpho

    Registrado
    diciembre de 2016
    Ubicación
    Mendoza
    Edad
    53
    Mensajes
    326
    Última visita
    18.04.2024

    Agradecimientos
     
    Recibidos
    226
    Enviados
    209

    Citaciones y menciones
     
    Mentioned
    49 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    15 Post(s)
    Poder de Reputación
    21
    Innovación / Point Value: 0 Concurso: Primer puesto / Point Value: 0

    Predeterminado

    Cita Iniciado por fastpho Ver Mensaje
    Hola @Joseg, El problema esta en el dato de envio es invalido, estuve probando el ejemplo original de RUI , y le falta el cierre de
    XML Código:
    1. </tns1:checkVat>
    agregando esta linea a la variable de envio Traffic-Conditions funciona bien ....
    Me trajo los datos correctos
    Saludos..
    Perdon , copie mal , el cierre que falta es ....
    COBOL Código:
    1. "</tns1:vatNumber>". *> falta del ejemplo de RUI
    Saludos ....

    0 Not allowed!

  5. #15
      Senior
    Avatar de Joseg

    Registrado
    abril de 2015
    Mensajes
    334
    Última visita
    17.05.2024

    Agradecimientos
     
    Recibidos
    148
    Enviados
    92

    Citaciones y menciones
     
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    4 Post(s)
    Poder de Reputación
    21
    Activista del Foro / Point Value: 0 Innovación / Point Value: 0

    Predeterminado

    Cita Iniciado por fastpho Ver Mensaje
    Perdon , copie mal , el cierre que falta es ....
    COBOL Código:
    1. "</tns1:vatNumber>". *> falta del ejemplo de RUI
    Saludos ....
    Não esta a faltar !!

    Ver este código. Continua a não funcionar

    COBOL Código:
    1.   MOVE ZERO TO COUNTER.
    2.      INSPECT XTRNIF TALLYING COUNTER  FOR ALL SPACES.
    3.      SUBTRACT COUNTER FROM 50 GIVING COUNTER. ADD 1 TO COUNTER.
    4.      MOVE "</tns1:vatNumber>" TO XTRNIF(COUNTER:).
    5.  
    6.      INVOKE COM "CREATE-OBJECT" USING WINHTTP RETURNING WEBSERVICE

    0 Not allowed!

  6. #16
      Administrador
    Avatar de Kuk

    Registrado
    enero de 2015
    Ubicación
    Madrid
    Edad
    39
    Mensajes
    2,294
    Última visita
    17.05.2024

    Agradecimientos
     
    Recibidos
    1,040
    Enviados
    888

    Citaciones y menciones
     
    Mentioned
    106 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    31 Post(s)
    Poder de Reputación
    10

    Predeterminado

    @Joseg, has probado con https?

    0 Not allowed!
    ¿Te han ayudado? NO TE OLVIDES de darle al botón
    ¿Quieres dirigirte a alguien en tu post? Notifícale con una mención, tienes 2 opciones:
    1. Haciendo clic en el icono al lado de su nick
    2. Haciendo clic en el botón en el editor y escribiendo su nick.

  7. #17
      Senior
    Avatar de Joseg

    Registrado
    abril de 2015
    Mensajes
    334
    Última visita
    17.05.2024

    Agradecimientos
     
    Recibidos
    148
    Enviados
    92

    Citaciones y menciones
     
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    4 Post(s)
    Poder de Reputación
    21
    Activista del Foro / Point Value: 0 Innovación / Point Value: 0

    Predeterminado

    Cita Iniciado por Kuk Ver Mensaje
    @Joseg, has probado con https?
    Com https tb não dá
    Imagem Anexada Imagem Anexada

    0 Not allowed!

  8. #18
      Senior
    Avatar de fastpho

    Registrado
    diciembre de 2016
    Ubicación
    Mendoza
    Edad
    53
    Mensajes
    326
    Última visita
    18.04.2024

    Agradecimientos
     
    Recibidos
    226
    Enviados
    209

    Citaciones y menciones
     
    Mentioned
    49 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    15 Post(s)
    Poder de Reputación
    21
    Innovación / Point Value: 0 Concurso: Primer puesto / Point Value: 0

    Predeterminado

    Hola @Joseg, te paso un ejemplo funcionando con tus datos ......
    La respuesta del servidor es leida con chilkat xml
    COBOL Código:
    1.  ENVIRONMENT     DIVISION.
    2.  DATA            DIVISION.
    3.  WORKING-STORAGE SECTION.
    4. *----------------------------------------------------------------------
    5. * Variables para el Objeto WinHttpRequest
    6. *----------------------------------------------------------------------
    7.  01  HttpJob           pic x(128) value "WinHttp.WinHttpRequest.5.1".
    8.  01  WinHttpReq        usage object reference OLE.
    9. *> POST , GET , PUT
    10.  01  TipoEnvio         pic x(4) value "POST".
    11. * Verdero o falso dependiendo si la comunicacion es asyn -  sync
    12.  01 OLE-TRUE           PIC 1(1)  BIT VALUE B"1".
    13.  01 OLE-FALSE          PIC 1(1)  BIT VALUE B"0".
    14. *https:
    15.  01 ServerName         pic x(256) value "http://ec.europa.eu/taxation_customs/vies/services/checkVatService".
    16.  01 ReqHead1           pic x(256) value "Content-Type".
    17.  01 ReqHead2           pic x(256) value "application/soap+xml; charset=utf-8".
    18.  01 status-string      pic  x(256).
    19.  01 Respuesta          PIC  x(450).
    20.  01 xTraffic-Conditions.
    21.     03 xtr01   pic x(42) value "<?xml version=""1.0"" encoding=""UTF-8""?>".
    22.     03 xtr02   pic x(80) value "<SOAP-ENV:Envelope xmlns:SOAP-ENV=""http://schemas.xmlsoap.org/soap/envelope/"">".
    23.     03 xtr03   pic x(17) value "  <SOAP-ENV:Body>".
    24.     03 xtr04   pic x(86) value "    <tns1:checkVat xmlns:tns1=""urn:ec.europa.eu:taxud:vies:services:checkVat:types"">".
    25.     03 xtr05   pic x(24) value "      <tns1:countryCode>".
    26.     03 xtrPais pic X(02) VALUE "PT". *>IT
    27.     03 XTR05A  pic X(19) VALUE "</tns1:countryCode>".
    28.     03 xtr06   pic x(22) value "      <tns1:vatNumber>".  *> 03 XTRNIF  pic X(11) VALUE "07392740960".
    29.     03 XTRNIF  pic X(9) VALUE "510944299".
    30.     03 xtr06C  pic x(17) value "</tns1:vatNumber>". *> falta del ejemplo de RUI
    31.     03 xtr07   pic x(16) value "</tns1:checkVat>".
    32.     03 xtr08   pic x(18) value "  </SOAP-ENV:Body>".
    33.     03 xtr09   pic x(20) value "</SOAP-ENV:Envelope>".
    34.  01 Traffic-Conditions redefines xTraffic-Conditions pic x(374).
    35.  01 ReturnValue      pic s9(5) comp-5 VALUE ZEROS.    
    36.  
    37.  01 Campo-Valida     pic x(10).
    38.  01 Campo-Name       pic x(30).
    39.  01 Campo-Address    pic x(30).  
    40.  
    41.  PROCEDURE       DIVISION.
    42. *-----------------    
    43.  INICIO-Peticion.
    44. *-----------------------------
    45. * Crea el objeto WinHttpRequest      
    46.      invoke OLE "CREATE-OBJECT"   using HttpJob returning WinHttpReq.
    47. *------------------------------
    48. * Open la  HTTP request.
    49.      invoke WinHttpReq  "OPEN" using   TipoEnvio ,  ServerName , ole-true.
    50. *
    51.       invoke WinHttpReq "setRequestHeader" using ReqHead1 ReqHead2.
    52. *
    53. * ------------------------------    
    54. *  Envia HTTP request.
    55.      invoke WinHttpReq  "send" using Traffic-Conditions.
    56. *------------------------------    
    57. * Espera la respuesta completa
    58.      invoke WinHttpReq  "WaitForResponse" using  ole-true.
    59. *-------------------------------
    60.  
    61. *--------------------------------------------
    62. * Muestra Estado de comunicacion
    63.  
    64.      invoke WinHttpReq  "get-StatusText" returning status-string.
    65.      display "*---------------------------------*"
    66.      display "Respuesta Server: " , status-string
    67.  
    68.      
    69. * ---------------------------------------------------------------------------
    70.      invoke WinHttpReq "get-Responsetext" RETURNING Respuesta.
    71.      display "*-------xml de salida--------*"    
    72.      display Respuesta.
    73.      display "*-------fin de salida--------*".      
    74.      
    75. * ---------------------------------------------------------------------------
    76.  Leo-Xml. *>chilkat xml
    77.      INVOKE ChilkatXml1 "LoadXml" USING Respuesta RETURNING ReturnValue.
    78.       if ReturnValue not = 1 then
    79.            INVOKE pow-self "DisplayMessage" USING "error"
    80.            exit program
    81.       end-if.
    82.  
    83.      INVOKE ChilkatXml1 "TagContent" USING "valid"    RETURNING Campo-Valida.
    84.      INVOKE ChilkatXml1 "TagContent" USING "name"     RETURNING Campo-Name.
    85.      INVOKE ChilkatXml1 "TagContent" USING "address"  RETURNING Campo-Address.
    86.      display "valid : " , Campo-Valida.
    87.      display "name  : " , Campo-Name.
    88.      display "address:" , Campo-Address.
    89.      
    90.      
    Saludos
    Imagem Anexada Imagem Anexada
    • Tipo de Archivo: png vat.png (19.8 KB, visto 131 veces)

    0 Not allowed!

  9. #19
      Senior
    Avatar de fastpho

    Registrado
    diciembre de 2016
    Ubicación
    Mendoza
    Edad
    53
    Mensajes
    326
    Última visita
    18.04.2024

    Agradecimientos
     
    Recibidos
    226
    Enviados
    209

    Citaciones y menciones
     
    Mentioned
    49 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    15 Post(s)
    Poder de Reputación
    21
    Innovación / Point Value: 0 Concurso: Primer puesto / Point Value: 0

    Predeterminado

    @Joseg, revisando detenidamente el ejemplo de RUI , no me había dado cuenta
    que inserta a la variable Traffic-Conditions , cuando el usuario ingresa el
    valor del NIF con las siguientes lineas
    COBOL Código:
    1.         MOVE ZERO TO COUNTER.
    2.     INSPECT XTRNIF TALLYING COUNTER  FOR ALL SPACES.
    3.     SUBTRACT COUNTER FROM 50 GIVING COUNTER. ADD 1 TO COUNTER.
    4.     MOVE "</tns1:vatNumber>" TO XTRNIF(COUNTER:).
    el problema que le veo al ejemplo es la peticion en las cabeceras
    cambiando estas lineas :
    COBOL Código:
    1.     INVOKE WEBSERVICE "setRequestHeader" USING OP6 OP4 .
    2.     INVOKE WEBSERVICE "setRequestHeader" USING OP6 OP5 .
    3.     INVOKE WEBSERVICE "setRequestHeader" USING  OP6 OP4.
    4.  
    Por esta sola :
    COBOL Código:
    1. INVOKE WEBSERVICE "setRequestHeader" USING OP4 OP5 .
    Funciona perfectamente
    Saludos .....

    0 Not allowed!

  10. #20
      Administrador
    Avatar de Kuk

    Registrado
    enero de 2015
    Ubicación
    Madrid
    Edad
    39
    Mensajes
    2,294
    Última visita
    17.05.2024

    Agradecimientos
     
    Recibidos
    1,040
    Enviados
    888

    Citaciones y menciones
     
    Mentioned
    106 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    31 Post(s)
    Poder de Reputación
    10

    Predeterminado

    @Joseg, he hecho pruebas (acabé instalando el Fujitsu).

    Funciona en mi caso comentando las siguientes líneas:

    COBOL Código:
    1.      *>INVOKE WEBSERVICE "setRequestHeader" USING OP6 OP4 .
    2.      *>INVOKE WEBSERVICE "setRequestHeader" USING OP6 OP5 .
    3.      *>INVOKE WEBSERVICE "setRequestHeader" using OP6 OP4 .

    Este es mi código:

    COBOL Código:
    1. *>
    2.  IDENTIFICATION DIVISION.
    3.  PROGRAM-ID.   TEST001.
    4.  
    5.  ENVIRONMENT     DIVISION.
    6.  CONFIGURATION SECTION.
    7.  REPOSITORY.
    8.      CLASS COM AS "*COM"
    9.      CLASS COMEXCEPTION AS "*COM-EXCEPTION".
    10.  
    11.  DATA            DIVISION.
    12.  WORKING-STORAGE SECTION.
    13.  01 WINHTTP               PIC X(128) VALUE "WinHttp.WinHttpRequest.5.1".
    14.  01 WSDL                  PIC X(256) VALUE "https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl".
    15.  01 xTraffic-Conditions   PIC X(384).
    16.      
    17.  *>01 Traffic-Conditions redefines xTraffic-Conditions pic x(386).
    18.  
    19.  01 WEBSERVICE USAGE OBJECT REFERENCE COM.
    20.  
    21.  01 OP1 PIC X(256) VALUE "POST".
    22.  01 OP2 PIC X(256) VALUE "http://ec.europa.eu/taxation_customs/vies/services/checkVatService/".
    23.  01 OP3 PIC X(256) VALUE "FALSE".
    24. *
    25.  01 OP4 PIC X(256) VALUE "Content-Type".
    26.  01 OP5 PIC X(256) VALUE "text/xml; charset=utf-8".
    27.  01 OP6 PIC X(256) VALUE "SOAPAction".
    28.  
    29.  
    30.  01 RESPOSTA    PIC X(8192).
    31.  
    32.  01 resultado1   PIC X(5).
    33.  01 resultado2   PIC X(5).
    34.  
    35.  *>01  long  PIC 9(4) COMP-5.
    36.  
    37.  PROCEDURE       DIVISION.
    38.  MAIN SECTION.
    39.  MAIN-00.
    40.  
    41.      STRING
    42.      '<?xml version="1.0" encoding="UTF-8"?>' & X"0D0A"
    43.      '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">' & X"0D0A"
    44.      '  <SOAP-ENV:Body>' & X"0D0A"
    45.      '    <tns1:checkVat xmlns:tns1="urn:ec.europa.eu:taxud:vies:services:checkVat:types">' & X"0D0A"
    46.      '      <tns1:countryCode>ES</tns1:countryCode>' & X"0D0A"
    47.      '      <tns1:vatNumber>B63272603</tns1:vatNumber>' & X"0D0A"
    48.      '    </tns1:checkVat>' & X"0D0A"
    49.      '  </SOAP-ENV:Body>' & X"0D0A"
    50.      '</SOAP-ENV:Envelope>' & X"0D0A"
    51. *          '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ec.europa.eu:taxud:vies:services:checkVat:types">' & X"0D0A"
    52. *     '   <soapenv:Header/>' & X"0D0A"
    53. *     '   <soapenv:Body>' & X"0D0A"
    54. *     '      <urn:checkVat>' & X"0D0A"
    55. *     '         <urn:countryCode>ES</urn:countryCode>' & X"0D0A"
    56. *     '         <urn:vatNumber>B63272603</urn:vatNumber>' & X"0D0A"
    57. *     '      </urn:checkVat>' & X"0D0A"
    58. *     '   </soapenv:Body>' & X"0D0A"
    59. *     '</soapenv:Envelope>' & X"0D0A"
    60.          DELIMITED BY SIZE INTO xTraffic-Conditions
    61.      
    62.      display xTraffic-Conditions
    63.      display " "    
    64.          
    65.      INVOKE COM "CREATE-OBJECT" USING WINHTTP RETURNING WEBSERVICE.
    66. *
    67.      INVOKE WEBSERVICE "OPEN" USING op1 op2 op3.
    68. *
    69.      *>INVOKE WEBSERVICE "setRequestHeader" USING OP6 OP4 .
    70.      *>INVOKE WEBSERVICE "setRequestHeader" USING OP6 OP5 .
    71.      *>INVOKE WEBSERVICE "setRequestHeader" using OP6 OP4 .
    72. *
    73.      
    74.      *>compute long = function stored-char-length(xTRAFFIC-CONDITIONS)      
    75.      *>display long
    76.      
    77.      INVOKE WEBSERVICE "send" USING xTRAFFIC-CONDITIONS
    78. *
    79.      INVOKE WEBSERVICE "get-Responsetext" RETURNING RESPOSTA
    80.  
    81.      display RESPOSTA
    82.      display " "
    83.      
    84.      unstring RESPOSTA delimited by "<valid>" into resultado1 resultado2
    85.      
    86.      inspect resultado2 replacing all "<" by spaces
    87.      
    88.      display "RESULTADO: " resultado2
    89.      
    90.      EXIT PROGRAM
    91.      .

    Resultado:

    CODE Código:
    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    3.   <SOAP-ENV:Body>
    4.     <tns1:checkVat xmlns:tns1="urn:ec.europa.eu:taxud:vies:services:checkVat:types">
    5.       <tns1:countryCode>ES</tns1:countryCode>
    6.       <tns1:vatNumber>B63272603</tns1:vatNumber>
    7.     </tns1:checkVat>
    8.   </SOAP-ENV:Body>
    9. </SOAP-ENV:Envelope>
    10.  
    11. <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><checkVatResponse xmlns="urn:ec.europa.eu:taxud:vies:services:checkVat:types"><countryCode>ES</countryCode><vatNumber>B63272603</vatNumber><requestDate>2021-11-11+01:00</requestDate><valid>true</valid><name>---</name><address>---</address></checkVatResponse></soap:Body></soap:Envelope>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
    12.  
    13. RESULTADO: true

    0 Not allowed!
    ¿Te han ayudado? NO TE OLVIDES de darle al botón
    ¿Quieres dirigirte a alguien en tu post? Notifícale con una mención, tienes 2 opciones:
    1. Haciendo clic en el icono al lado de su nick
    2. Haciendo clic en el botón en el editor y escribiendo su nick.

Página 2 de 3 PrimerPrimer 1 2 3 ÚltimoÚltimo

Información de Tema

Usuarios Viendo este Tema

Actualmente hay 1 usuarios viendo este tema. (0 miembros y 1 visitantes)

Temas Similares

  1. [Petición] Gerar Serial Number
    Por Paulo en el foro Cocina Casera
    Respuestas: 4
    Último Mensaje: 04.09.2018, 14:58

Marcadores

Marcadores

Permisos de Publicación

  • No puedes crear nuevos temas
  • No puedes responder temas
  • No puedes subir archivos adjuntos
  • No puedes editar tus mensajes
  •