[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

http_url_post_xml



   This is one of my early attempt to make a SOAP program.
   I would like to enquiry the "VIES" webservices that check the European
   VAT Number.
   The program seems to work correctly but i found the "result" variable
   empty.
   I compiled "as is" EXAMPLE18 of  LIBHTTP and when i type CALL
   EXAMPLE18 PARM('USD' 'JPY' 12.00) the result is 0.00
   What's wrong on my code or in my environment?
   Above you can see my code and the log file (that seems correct).
   Hope to get an answer soon.
   Thank you all in advance.
   Best regards
   P.S. The webservice send back three fields ("valid", "name",
   "address"), the first  is a boolean type, how can I get and manage it?
   H dftactgrp(*no) bnddir('HTTPAPI':'QC2LE')
    *
   D CHKVAT          PR                  ExtPgm('CHKVAT')
   D    countryCode                 2a   const
   D    vatNumber                  20a   const

    *
   D CHKVAT          PI
   D    countryCode                 2a   const
   D    vatNumber                  20a   const

    *
    /copy httpapi_h
    *
   D Incoming        PR
   D   result                   32767a
   D   depth                       10I 0 value
   D   name                      1024A   varying const
   D   path                     24576A   varying const
   D   value                    32767A   varying const
   D   attrs                         *   dim(32767)
   D                                     const options(*varsize)

   D SOAP            s          32767A   varying
   D rc              s             10I 0
   D Result          s           1000a   varying
   D indirizzo       s             35a


    /free
     http_debug(*on);
     SOAP =
      '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
     +' <SOAP-ENV:Envelope'
     +' xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";'
     +' xmlns:apachesoap="http://xml.apache.org/xml-soap";'
     +' xmlns:impl="urn:ec.europa.eu:taxud:vies:services:checkVat"'
     +' xmlns:intf="urn:ec.europa.eu:taxud:vies:services:checkVat"'
   +' xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";'

   +' xmlns:tns1="urn:ec.europa.eu:taxud:vies:services:checkVat:types"'

   +' xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";'

   +' xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";'

   +' xmlns:xsd="http://www.w3.org/2001/XMLSchema";'

   +' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >'

   +' <SOAP-ENV:Body>'

   +' <mns1:checkVat xmlns:mns1="urn:ec.europa.eu:taxud:vies:services:'

   +'checkVat">'

   +' <countryCode>' + %trim(countryCode) + '</countryCode>'

   +' <vatNumber>' + %trim(vatNumber) + '</vatNumber>'

   +' </mns1:checkVat>'

   +' </SOAP-ENV:Body>'

   +' </SOAP-ENV:Envelope>';



   rc = http_url_post_xml(


   'http://ec.europa.eu/taxation_customs/vies/api/checkVatPort'
                     : %addr(SOAP) + 2

                     : %len(SOAP)

                       : %len(SOAP)
                       : *NULL
                       : %paddr(Incoming)
                       : %addr(Result)
                       : HTTP_TIMEOUT
                       : HTTP_USERAGENT
                       : 'text/xml'
                       : ' ');

     if (rc <> 1);
        http_crash();
     else;
        http_comp(Result);
     endif;

     *inlr = *on;

    /end-free

   P Incoming        B
   D Incoming        PI
   D   Result                   32767a
   D   depth                       10I 0 value
   D   name                      1024A   varying const
   D   path                     24576A   varying const
   D   value                    32767A   varying const
   D   attrs                         *   dim(32767)
   D                                     const options(*varsize)

    /free
        if (name = 'address');
             Result = value;
        endif;
    /end-free
   P                 E
   *****************************************************************
   This is the httpapi_debug.txt file:
   HTTPAPI Ver 1.17 released 2006-09-23
   New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819.
   ProtLoc=0
   http_persist_open(): entered
   http_long_ParseURL(): entered
   http_persist_post(): entered
   http_long_ParseURL(): entered
   do_post(): entered
   POST /taxation_customs/vies/api/checkVatPort HTTP/1.1
   Host: ec.europa.eu
   User-Agent: http-api/1.17
   Content-Type: text/xml
   SOAPAction:
   Expect: 100-continue
   Content-Length: 834
   recvresp(): entered
   HTTP/1.1 100 Continue
   SetError() £13: HTTP/1.1 100 Continue
   senddoc(): entered
   <?xml version="1.0" encoding="UTF-8" standalone="no"?>
   <SOAP-ENV:Envelope
   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
   xmlns:apachesoap="http://xml.apache.org/xml-soap";
   xmlns:impl="urn:ec.europa.eu:taxud:vies:services:checkVat"
   xmlns:intf="urn:ec.europa.eu:taxud:vies:services:checkVat"
   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
   xmlns:tns1="urn:ec.europa.eu:taxud:vies:services:checkVat:types"
   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
   xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
   xmlns:xsd="http://www.w3.org/2001/XMLSchema";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >
   <SOAP-ENV:Body> <mns1:checkVat
   xmlns:mns1="urn:ec.europa.eu:taxud:vies:services:checkVat">
   <countryCode>BE</countryCode> <vatNumber>571981284</vatNumber>
   </mns1:checkVat> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
   recvresp(): entered
   HTTP/1.1 200 OK
   Date: Wed, 25 Jul 2007 13:46:44 GMT
   Server: WebLogic Server 8.1 SP3 Tue Jun 29 23:11:19 PDT 2004 404973
   Content-type: text/xml; charset=utf-8
   Transfer-encoding: chunked
   Via: 1.1 S1PS
   Connection: close
   SetError() £13: HTTP/1.1 200 OK
   recvdoc parms: chunked 0
   header_load_cookies() entered
   recvchunk(): entered
   get_chunk_size(): entered
   0294
   chunk size = 660
   get_chunk_size returned 660
   calling comm_blockread
   <?xml version="1.0" encoding="UTF-8"?>
   <soapenv:Envelope
   xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
   xmlns:xsd="http://www.w3.org/2001/XMLSchema";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
    <soapenv:Body>
     <checkVatResponse
   xmlns="urn:ec.europa.eu:taxud:vies:services:checkVat">
      <countryCode xmlns="">BE</countryCode>
      <vatNumber xmlns="">571981284</vatNumber>
      <requestDate xmlns="">2007-07-25</requestDate>
      <valid xsi:type="xsd:boolean" xmlns="">true</valid>
      <name xmlns="">MME    AHN MIREILLE</name>
      <address xmlns="">BLOEMHOF 73
   1630  LINKEBEEK</address>
     </checkVatResponse>
    </soapenv:Body>
   </soapenv:Envelope>
   comm_blockread returned 660
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------