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

XML Not Parsing



   I've written and HTTPAPI program that successfully attaches to a web
   service and retrieves a list (In this case order numbers). I can see
   all of this in the debug file in /tmp. However, the program is not
   parsing the returned XML into the array variable so I can then process
   further. At this point, I am a bit lost. Attached is the program code.
     H DFTACTGRP(*NO) BNDDIR('HTTPAPI':'QC2LE')
?     *==========================================================================
     FXMLREQPF  IF   E           K DISK
     D OrdersIn        s             15a   Dim(200)
      *
CPY  /COPY QRPGLESRC,HTTPAPI_H                  ? HTTP-API Service Program
      *
     D ElementStart    PR
     D   UserData                      *   value
     D   depth                       10I 0 value
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
     D ElementEnd      PR
     D   UserData                      *   value
     D   depth                       10I 0 value
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   value                    65535A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
     D Add_SOAPACTION  PR
     D   Header                    1024A   varying
     D   UserData                      *   value

     D REQUEST         s          65535A   varying
     D Url             C                   'http://10.3.53.75:8091/axis/service+
     D                                     s/OrderRetrieve'
     D x               s              3  0
     D rc              s             10I 0
     D lenrqs          s              5  0
?     * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      /free
         XMLTYP = 'ORDLST' ;
         Request = '' ;
         chain (XMLTYP) Rxmlreq ;
         dow not(%eof) ;
         Request = %trim(request) + %trim(XMLREQ) ;
         reade (XMLTYP) Rxmlreq ;
         enddo ;

        http_debug(*ON);

         http_xproc( HTTP_POINT_ADDL_HEADER
                 : %paddr(Add_SOAPACTION) );

        lenrqs = %len(request);

        rc = http_url_post_xml(Url
                         : %addr(Request) + 2
                         : %len(Request)
                         : %paddr(ElementStart)
                         : %paddr(ElementEnd)
                         : %addr(OrdersIn)
                         : HTTP_TIMEOUT
                         : HTTP_USERAGENT
                         : 'text/xml; charset=utf-8') ;

       if (rc <> 1);
          http_crash();
       endif;
       *inlr = *on ;

      /end-free
     P ElementStart    B
     D ElementStart    PI
     D   UserData                      *   value
     D   depth                       10I 0 value
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
      /free
           if name = 'OrderId'  ;
           x = x+1 ;
           endif ;
           return ;
      /end-free
     P                 E

     P ElementEnd      B
     D ElementEnd      PI
     D   UserData                      *   value
     D   depth                       10I 0 value
     D   name                      1024A   varying const
     D   path                     24576A   varying const
     D   value                    65535A   varying const
     D   attrs                         *   dim(32767)
     D                                     const options(*varsize)
      /free
           if name = 'OrderId'  ;
           OrdersIn (x) =  %trim(value) ;
           endif ;
           return ;
      /end-free
     P                 E
      *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     P Add_SOAPACTION  B
     D Add_SOAPACTION  PI
     D   Header                    1024A   varying
     D   UserData                      *   value
      /free
         Header = 'SOAPAction: " "' + x'0d25' ;
      /end-free
     P                 E
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------