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

Web service call using Example18



   I'm receiving the following message in the "value" field when calling
   my web service:


   Server was unable to read request. --> There is an error in
   XML document (1, 647). --> 'Element' is an invalid node type
   . Line 1, position 647.


   Is it that my XML (inputXMLstring) is not correct?  I've followed the
   SOAP for the web service as defined and can pass in the same XML data
   successfully when testing on the web site.


   I've included my mocked-up source of EXAMPLE18 as well.


   Any help would be greatly appreciated!


   Thanks,



   Michael Erickson

   RDA - Milwaukee

   414.423.0100 ext. 3271

   [1]mailto:Michael_Erickson@xxxxxx

References

   1. mailto:Michael_Erickson@xxxxxx
ÿþ  5722WDS V5R4M0  060210                  SEU SOURCE LISTING                            06/22/08 18:01:11    REIMAN       PAGE    1

  SOURCE FILE . . . . . . .  LIBHTTP/QRPGLESRC

  MEMBER  . . . . . . . . .  EXAMPLE18M

  SEQNBR*...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... 0

    100       *  This is an example of calling a SOAP Web service w/HTTPAPI.                                            02/10/06

    200       *                                                                                                         02/10/06

    300       *  This sample calls the Currency Exchange Rate Web service                                               02/10/06

    400       *  provided by WebserviceX.net. For more info, search for it                                              03/10/06

    500       *  at   http://www.WebserviceX.net                                                                        03/10/06

    600       *                                                                                                         02/10/06

    700       *  To Compile (requires V5R1):                                                                            02/10/06

    800       *     CRTBNDRPG PGM(EXAMPLE18M) SRCFILE(libhttp/QRPGLESRC)                                                02/28/08

    900       *                                                                                                         02/10/06

   1000       *  To Run:                                                                                                02/10/06

   1100       *     CALL EXAMPLE18M PARM('Addr1' 'Addr2' 'Addr3' 'Addr4' 'City' 'ST' 'PostalCode' 'Country')            06/20/08

   1200       *                                                                                                         02/10/06

   1300       *  (This shows the value of USD 12.00 in Japanese currency.)                                              02/10/06

   1400       *                                                                                                         02/10/06

   1500      H DFTACTGRP(*NO) BNDDIR('HTTPAPI':'QC2LE')                                                                 03/24/06

   1600                                                                                                                 02/06/06

   1700      D EXAMPLE18M      PR                  ExtPgm('EXAMPLE18M')                                                 03/03/08

   1800      D   Addr1                       50A   const                                                                06/20/08

   1801      D   Addr2                       50A   const                                                                06/20/08

   1802      D   Addr3                       50A   const                                                                06/20/08

   1803      D   Addr4                       50A   const                                                                06/20/08

   1900      D   City                        50A   const                                                                06/20/08

   1901      D   State                        2A   const                                                                06/20/08

   2000      D   PostalCd                    10A   const                                                                06/20/08

   2001      D   Country                     50A   const                                                                06/20/08

   2100      D EXAMPLE18M      PI                                                                                       03/03/08

   2101      D   Addr1                       50A   const                                                                06/20/08

   2102      D   Addr2                       50A   const                                                                06/20/08

   2103      D   Addr3                       50A   const                                                                06/20/08

   2104      D   Addr4                       50A   const                                                                06/20/08

   2105      D   City                        50A   const                                                                06/20/08

   2106      D   State                        2A   const                                                                06/20/08

   2107      D   PostalCd                    10A   const                                                                06/20/08

   2108      D   Country                     50A   const                                                                06/20/08

   2500                                                                                                                 02/06/06

   2600       /copy httpapi_h                                                                                           02/06/06

   2700                                                                                                                 02/06/06

   2800      D Incoming        PR                                                                                       02/06/06

   2900      D   xmldata                  32767A   varying                                                              06/18/08

   3000      D   depth                       10I 0 value                                                                02/06/06

   3100      D   name                      1024A   varying const                                                        02/06/06

   3200      D   path                     24576A   varying const                                                        02/06/06

   3300      D   value                    32767A   varying const                                                        02/06/06

   3400      D   attrs                         *   dim(32767)                                                           02/06/06

   3500      D                                     const options(*varsize)                                              02/06/06

   3501                                                                                                                 06/20/08

   3504      D Add_SOAPACTION  PR                                                                                       06/20/08

   3505      D   Header                    1024A   varying                                                              06/20/08

   3506      D   UserData                      *   value                                                                06/20/08

   3507                                                                                                                 06/20/08

   3602      D httplink        s             80A   inz('http://uspvl3k46-dev.us.rdiges+                                 06/19/08

   3604      D                                     t.com/firstlogiciqservice/Firstlogic+                                06/09/08

   3605      D                                     IQService.asmx')                                                     06/09/08

  5722WDS V5R4M0  060210                  SEU SOURCE LISTING                            06/22/08 18:01:11    REIMAN       PAGE    2

  SOURCE FILE . . . . . . .  LIBHTTP/QRPGLESRC

  MEMBER  . . . . . . . . .  EXAMPLE18M

  SEQNBR*...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... 0

   3606      D soapAction      s             68A   inz('urn:schemas-firstlogic-com-soap+                                06/20/08

   3607      D                                     /runTransactionDataflowWithXmlData')                                 06/20/08

   3608                                                                                                                 06/18/08

   3700      D localHost       s              9A   inz('localhost')                                                     06/19/08

   3800      D port            s              5A   inz('20004')                                                         06/19/08

   3900      D repositoryPath  s             49A   inz('C:\dqxi\11_7_devt\repository+                                   06/19/08

   4000      D                                     \configuration_rules\')                                              03/03/08

   4100      D dataFlow        s             48A   inz('projects\Reiman\new_address_cle+                                06/19/08

   4200      D                                     anse_usa_test.xml')                                                  06/09/08

   4300      D varOptions      s             33A   inz('dqxiserver_devt_substitutions+                                  06/19/08

   4400      D                                     .xml')                                                               03/03/08

   4500      D shouldBlock     s              5A   inz('false')                                                         06/20/08

   4600      D inputXMLstring  s            768A   varying                                                              06/19/08

   4700      D retrnXMLstring  s            768A   varying                                                              06/19/08

   4800      D SOAP            s          32767A   varying                                                              02/06/06

   4900      D rc              s             10I 0                                                                      02/06/06

   5000      D xmldata         s          32767A   varying                                                              06/18/08

   5001      D value           s          32767A   varying                                                              06/19/08

   5100      D Result          s             12P 2                                                                      02/07/06

   5200      D msg             s             80A                                                                        06/20/08

   5201                                                                                                                 06/20/08

   5300       /free                                                                                                     02/06/06

   5400        inputXMLstring = '<dataset><record><addr_1>726 7th Apt 24</addr_1>+                                      03/03/08

   5500                         <addr_2></addr_2><addr_3 /><addr_4 />+                                                  03/03/08

   5600                         <city>Grafton</city><state>WI</state>+                                                  03/03/08

   5700                         <postal_code>53029</postal_code>+                                                       03/03/08

   5800                         <country_name>United States</country_name>+                                             03/03/08

   5900                         </record></dataset>';                                                                   03/03/08

   6000                                                                                                                 03/03/08

   6100        SOAP =                                                                                                   03/10/06

   6200        '<?xml version="1.0" encoding="utf-8"?>'                                                                 06/20/08

   6300        +'<soap:Envelope'                                                                                        06/20/08

   6400        +' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'                                                05/30/08

   6500        +' xmlns:xsd="http://www.w3.org/2001/XMLSchema"'                                                         05/30/08

   6600        +' xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'                                              05/30/08

   6700        +'<soap:Body>'                                                                                           06/18/08

   6800        +' <runTransactionDataflowWithXmlData'                                                                   06/20/08

   6801        +' xmlns="urn:schemas-firstlogic-com-soap">'                                                             06/20/08

   7000        +' <hostName>'+  %trim(localHost) +'</hostName>'                                                         06/19/08

   7100        +' <portNumber>'+ %trim(port) +'</portNumber>'                                                           06/19/08

   7200        +' <reposPath>'+ %trim(repositoryPath) +'</reposPath>'                                                   06/19/08

   7300        +' <dataflowOptions>'+ %trim(dataFlow) +'</dataflowOptions>'                                             06/19/08

   7400        +' <substVarOptions>'+ %trim(varOptions) +'</substVarOptions>'                                           06/19/08

   7500        +' <shouldBlock>'+ %trim(shouldBlock) +'</shouldBlock>'                                                  06/19/08

   7600        +' <inputXmlStringData>'+ %trim(inputXMLstring) +                                                        06/19/08

   7700                '</inputXmlStringData>'                                                                          06/19/08

   7800        +' </runTransactionDataflowWithXmlData>'                                                                 06/19/08

   7900        +'</soap:Body>'                                                                                          06/18/08

   8000        +'</soap:Envelope>';                                                                                     06/18/08

   8100                                                                                                                 02/06/06

   8101        http_xproc( HTTP_POINT_ADDL_HEADER                                                                       06/20/08

   8102                          : %paddr(Add_SOAPACTION) );                                                            06/20/08

   8103                                                                                                                 06/20/08

  5722WDS V5R4M0  060210                  SEU SOURCE LISTING                            06/22/08 18:01:11    REIMAN       PAGE    3

  SOURCE FILE . . . . . . .  LIBHTTP/QRPGLESRC

  MEMBER  . . . . . . . . .  EXAMPLE18M

  SEQNBR*...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... 0

   8200        rc = http_url_post_xml(httplink                                                                          06/19/08

   8400                          : %addr(SOAP) + 2                                                                      06/20/08

   8500                          : %len(SOAP)                                                                           02/06/06

   8600                          : *NULL                                                                                06/19/08

   8700                          : %paddr(Incoming)                                                                     02/06/06

   8800                          : %addr(xmldata)                                                                       06/18/08

   8900                          : HTTP_TIMEOUT                                                                         02/06/06

   9000                          : HTTP_USERAGENT                                                                       02/06/06

   9100                          : 'text/xml; charset=utf-8');                                                          06/20/08

   9200           //               : '"'+ %trim(soapAction) +'"');                                                      06/20/08

   9300        if (rc <> 1);                                                                                            02/06/06

   9301           msg = http_error();                                                                                   06/20/08

   9400           http_crash();                                                                                         06/20/08

   9500        else;                                                                                                    02/06/06

   9600           http_comp(%trim(xmldata));                                                                            06/20/08

   9800        endif;                                                                                                   02/06/06

   9900                                                                                                                 02/06/06

  10000        *inlr = *on;                                                                                             02/06/06

  10100                                                                                                                 02/06/06

  10200       /end-free                                                                                                 02/06/06

  10300                                                                                                                 02/06/06

  10400      P Incoming        B                                                                                        02/06/06

  10500      D Incoming        PI                                                                                       02/06/06

  10600      D   xmldata                  32767A   varying                                                              06/18/08

  10700      D   depth                       10I 0 value                                                                02/06/06

  10800      D   name                      1024A   varying const                                                        02/06/06

  10900      D   path                     24576A   varying const                                                        02/06/06

  11000      D   value                    32767A   varying const                                                        02/06/06

  11100      D   attrs                         *   dim(32767)                                                           02/06/06

  11200      D                                     const options(*varsize)                                              02/06/06

  11300                                                                                                                 03/24/06

  11700       /free                                                                                                     02/06/06

  11800           if (name = 'runTransactionDataflowWithXmlDataResult');                                                06/18/08

  11900              xmldata = value;                                                                                   06/18/08

  12000           endif;                                                                                                02/06/06

  12100       /end-free                                                                                                 02/06/06

  12200      P                 E                                                                                        02/06/06

  12201                                                                                                                 06/20/08

  12202       *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                                            06/20/08

  12203       * HTTPAPI will call this (because we set it with http_xproc)                                              06/20/08

  12204       * just before sending the HTTP headers to the remote server.                                              06/20/08

  12205       * This procedure lets us add any header we like to the                                                    06/20/08

  12206       * HTTP request.                                                                                           06/20/08

  12207       *                                                                                                         06/20/08

  12208       * In this example, I'll use it to supply the SoapAction:                                                  06/20/08

  12209       * header.  This way, I can supply a SOAPAction that's up to                                               06/20/08

  12210       * 1024 characters long.                                                                                   06/20/08

  12211       *                                                                                                         06/20/08

  12212       * NOTE: Make sure you leave off the SOAPAction header on the                                              06/20/08

  12213       *       HTTP_url_post_xml, above, otherwise you'll send two                                               06/20/08

  12214       *       of them!                                                                                          06/20/08

  12215       *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++                                            06/20/08

  12216      P Add_SOAPACTION  B                                                                                        06/20/08

  5722WDS V5R4M0  060210                  SEU SOURCE LISTING                            06/22/08 18:01:11    REIMAN       PAGE    4

  SOURCE FILE . . . . . . .  LIBHTTP/QRPGLESRC

  MEMBER  . . . . . . . . .  EXAMPLE18M

  SEQNBR*...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 ...+... 9 ...+... 0

  12217      D Add_SOAPACTION  PI                                                                                       06/20/08

  12218      D   Header                    1024A   varying                                                              06/20/08

  12219      D   UserData                      *   value                                                                06/20/08

  12220       /free                                                                                                     06/20/08

  12221          Header = 'SOAPAction: '                                                                                06/20/08

  12222                 + '"'+ %trim(soapAction) +'"'                                                                   06/20/08

  12223                 + x'0d25';                                                                                      06/20/08

  12224       /end-free                                                                                                 06/20/08

  12225      P                 E                                                                                        06/20/08

                                  * * * *  E N D  O F  S O U R C E  * * * *

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------