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

RE: New to XML - Dequeue2 Request Issue



   OK, I'm still struggling with the base64_decode portion of this.  I've
   searched thru the forum and I'm not finding what I think I need.  I
   could be wrong.  Where in my process will a do the call to
   base64_decode and what is the correct code to add?
   Thanks again!
   Corby Weaver
   From:        Mike Krebs <mkrebs@xxxxxxxxxxxxxxxxxx>
   To:        HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>,
   Date:        12/11/2015 12:28 PM
   Subject:        RE: New to XML - Dequeue2 Request Issue
   Sent by:        ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
     __________________________________________________________________

   Upon further review, I see you don't understand what happens here:
       if (http_parse_xml_stmf( soapfile
                            : HTTP_XML_CALC
                            : *null
                            : %paddr(SaveEmbed)
                            : %addr(embfile) ) < 0);
   The Expat parser and Scott's port of it handle the incoming XML as a
   stream of elements. There are various ways to parse the XML. The API as
   called above will call SaveEmbed each time it gets to the end of an
   element. That is on a </whatever>. By looking at your incoming data,
   transactions is the inner most element we are interested in. So, my
   code checks if name matches transactions. It is called a bunch of other
   times (every time there is a </whatever>) but every other time it does
   not do anything other than return.
   So your SaveEmbed was working but the last element didn't have a
   "value" with it. So, your code created the file with just the header.
   You want just the base64 encoded data in the file. Then you can decode
   the file and parse that for the actual data.
   -----Original Message-----
   From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   [[1]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Mike
   Krebs
   Sent: Friday, December 11, 2015 11:47 AM
   To: HTTPAPI and FTPAPI Projects
   Subject: RE: New to XML - Dequeue2 Request Issue
   You didn't make it convenient by including extra data in your post.
   Many of us don't just read code, we try to code the problem ourselves!
   I managed to recreate the SOAPfile data and was able to parse using
   your saveembed with minor tweak to create the embfile.
   I saved the SOAPfile data to a file called /home/mikekr/corby.xml and
   changed the "data" portion to <transactions>base64stuff</transactions>
   Here is my complete program that parses corby.xml and creates embfile
   with what you need. Change the file names appropriately and see if you
   have the base64 encoded data in /tmp/OmniTracsFuleFin.soap after you
   run it.
   h bnddir('HTTPAPI')
   /copy httpapi_h
   /copy ifsio_h
    dcl-s embfile  varchar(50);
    dcl-s soapfile varchar(50);
   D SaveEmbed       PR
   D   embfile                     50a   varying
   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)
    http_debug(*on);
    soapfile = '/home/MIKEKR/corby.xml';
    embfile  = '/tmp/OmniTracsFuelFin.soap';
       if (http_parse_xml_stmf( soapfile
                            : HTTP_XML_CALC
                            : *null
                            : %paddr(SaveEmbed)
                            : %addr(embfile) ) < 0);
          // callp close(fd);
          // unlink(soapfile);
          // unlink(embfile);
           http_crash();
         endif;
     *inlr = *on;
     //  unlink(soapfile);
   P SaveEmbed       B
   D SaveEmbed       PI
   D   embfile                     50a   varying
   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 writeConst      PR            10I 0 ExtProc('write')
   D  fildes                       10i 0 value
   D  buf                       65535A   const options(*varsize)
   D  bytes                        10U 0 value
   D xmlhdr          s             80a   varying
   D fd              s             10i 0
      if name = 'transactions';
      unlink(embfile);
      fd = open(embfile:O_CREAT+O_CCSID+O_WRONLY
                :S_IRUSR + S_IWUSR:819);
      callp close(fd);
      fd = open(embfile: O_WRONLY+O_TEXTDATA);
      writeConst(fd: value:  %len(value));
      callp close(fd);
      endif;
   P                 e
   -----Original Message-----
   From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   [[2]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott
   Klement
   Sent: Friday, December 11, 2015 8:58 AM
   To: HTTPAPI and FTPAPI Projects
   Subject: Re: New to XML - Dequeue2 Request Issue
   Corby,
   I see that a few weeks ago, you acknowledged that the data being sent
   to
   you is base64-encoded..   As far as I can tell, however, you never call
   the base64_decode() routine to decode it...   am I missing something?
   -SK
   On 12/11/2015 8:22 AM, corby.weaver@xxxxxxxxxxxxxxxxx wrote:
   >     Here is my full code, less proprietary info.  I wouldn't normally
   >     include D specs, but I want to be sure all of my bases are
   covered.
   >     0012.00 H DFTACTGRP(*NO) BNDDIR('HTTPAPI':'QC2LE':'BASE64')
   >     0013.00  /define DEBUGGING
   >     0014.00
   >     0020.00  /copy httpapi_h
   >     0021.00  /copy base64_h
   >     0022.00  /copy ifsio_h
   >     0023.00
   >     0024.00 D QCMDEXC         PR                  ExtPgm('QCMDEXC')
   >     0025.00 D   command                  32702a   const
   options(*varsize)
   >     0026.00 D   len                         15p 5 const
   >     0027.00 D   igc                          3a   const
   options(*nopass)
   >     0028.00
   >     0029.00 D SOAP            s          32767A   varying
   >     0030.00 D rc              s             10I 0
   >     0031.00 D fd              s             10I 0
   >     0032.00 D soapfile        s             50a   varying
   >     0033.00 D embfile         s             50a   varying
   >     0034.00 D fuel            ds                  likeds(fuel_t)
   >     0035.00 D cmd             s            200A
   >     0036.00 D wait            s              1A
   >     0037.00
   >     0038.00 D SaveEmbed       PR
   >     0039.00 D   embfile                     50a   varying
   >     0040.00 D   depth                       10I 0 value
   >     0041.00 D   name                      1024A   varying const
   >     0042.00 D   path                     24576A   varying const
   >     0043.00 D   value                    32767A   varying const
   >     0044.00 D   attrs                         *   dim(32767)
   >     0045.00 D                                     const
   options(*varsize)
   >     0046.00
   >     0047.00 D fuel_t          ds                  qualified
   >     0048.00 D                                     based(Template)
   >     0049.00 D   vehicle                     20a   varying
   >     0050.00 D   driver                      30a   varying
   >     0051.00 D   comp                        30a   varying
   >     0052.00
   >     0053.00 D embedded        PR
   >     0054.00 D   fuel                              likeds(fuel_t)
   >     0055.00 D   depth                       10I 0 value
   >     0056.00 D   name                      1024A   varying const
   >     0057.00 D   path                     24576A   varying const
   >     0058.00 D   value                    32767A   varying const
   >     0059.00 D   attrs                         *   dim(32767)
   >     0060.00 D                                     const
   options(*varsize)
   >
   >     0061.00 D                 ds
   >
   >     0062.00 D DS_TimeStamp                    z
   >
   >     0063.00 D  ds_curdate                   10
   overlay(ds_timestamp:1)
   >
   >     0064.00 D  ds_curtime                   12
   overlay(ds_timestamp:12)
   >
   >     0065.00
   >
   >     0066.00 D                 ds
   >
   >     0067.00 D DS_TimeStampB                   z
   >
   >     0068.00 D  ds_curdateB                  10
   overlay(ds_timestampB:1)
   >
   >     0069.00 D  ds_curtimeB                  12
   overlay(ds_timestampB:12)
   >
   >     0070.00
   >
   >     0071.00 D createdate      s             10
   >
   >     0072.00 D createtime      s             12
   >
   >     0073.00 D expiredate      s             10
   >
   >     0074.00 D expiretime      s             12
   >
   >     0075.00 D reqfrmdate      s             10
   >
   >     0076.00 D reqtodate       s             10
   >
   >     0077.00 D digit1099       s              1
   >
   >     0078.00
   >
   >     0079.00 D tokentxt        s             18a   varying
   >
   >     0080.00 D token64         s             24a
   >     0081.00 D p_tokenUTF      s               *
   >     0082.00 D utflen          s             10i 0
   >     0083.00 D b64len          s             10i 0
   >     0084.00 D timoffset       s              3  0
   >     0085.00 D lasttrip        s              8
   >     0086.00
   >     0087.00 C     *entry        plist
   >     0088.00 C                   parm                    timoffset
   >     0089.00 C                   parm                    lasttrip
   >     0090.00
   >     0091.00 C                   Time                    DS_TimeStamp
   >     0092.00
   >     0093.00  /free
   >     0094.00  /if defined(DEBUGGING)
   >     0095.00    http_debug(*ON);
   >     0096.00  /endif
   >     0097.00    *inlr = *on;
   >     0098.00
   >     0099.00   DS_TimeStampB = DS_TimeStamp;
   >     0100.00
   >
   >     0101.00   // Calculate UTC Create Time And Date
   >
   >     0102.00   timoffset = timoffset * -1;
   >
   >     0103.00   DS_TimeStamp = DS_TimeStamp + %minutes(timoffset);
   >
   >     0104.00   createdate = ds_curdate;
   >
   >     0105.00   createtime = ds_curtime;
   >
   >     0106.00   %subst(createtime:3:1) = ':';
   >
   >     0107.00   %subst(createtime:6:1) = ':';
   >
   >     0108.00
   >
   >     0109.00   // Calculate UTC Expire Time And Date
   >
   >     0110.00   DS_TimeStamp = DS_TimeStamp + %minutes(5);
   >
   >     0111.00   expiredate = ds_curdate;
   >
   >     0112.00   expiretime = ds_curtime;
   >
   >     0113.00   %subst(expiretime:3:1) = ':';
   >
   >     0114.00   %subst(expiretime:6:1) = ':';
   >
   >     0115.00
   >
   >     0116.00   // Calculate UTC Requested To Date
   >
   >     0117.00   DS_TimeStampB = DS_TimeStampB - %days(1);
   >
   >     0118.00   reqtodate = ds_curdateB;
   >
   >     0119.00
   >
   >     0120.00   // Calculate UTC Requested From Date
   >     0121.00   DS_TimeStampB = DS_TimeStampB - %days(1);
   >     0122.00   reqfrmdate = ds_curdateB;
   >     0123.00
   >     0124.00   http_setCCSIDs( 1208: 0 );
   >     0125.00
   >     0126.00   tokentxt = %triml(createdate + createtime);
   >     0127.00
   >     0128.00   utflen = HTTP_xlatedyn( %len(tokentxt)
   >     0129.00                         : %addr(tokentxt) + 2
   >     0130.00                         : TO_ASCII
   >     0131.00                         : p_tokenUTF );
   >     0132.00
   >     0133.00   b64len = base64_encode( p_tokenUTF
   >     0134.00                         : utflen
   >     0135.00                         : %addr(token64)
   >     0136.00                         : %size(token64) );
   >     0137.00
   >     0138.00   dealloc p_tokenUTF;
   >     0139.00
   >     0140.00   // Note:  http_debug(*ON/*OFF) can be used to turn
   debugging
   >
   >     0141.00   //        on and off.  When debugging is turned on,
   >     diagnostic
   >     0142.00   //        info is written to an IFS file named
   >
   >     0143.00   //        /tmp/httpapi_debug.txt
   >
   >     0144.00
   >
   >     0145.00   //http_debug(*ON);
   >
   >     0146.00
   >
   >     0147.00   // Note:  http_XmlStripCRLF(*ON/*OFF) controls whether
   or not
   >
   >     0148.00   //        the XML parser removes CR and LF characters
   from
   >     the
   >     0149.00   //        Xml data that's passed to your 'Incoming'
   >     procedure.
   >     0150.00
   >
   >     0151.00   http_XmlStripCRLF(*ON);
   >
   >     0152.00
   >
   >     0153.00   SOAP =
   >
   >     0154.00    '<?xml version="1.0" encoding="UTF-8"
   standalone="no"?>'
   >
   >     0155.00   +'<SOAP-ENV:Envelope'
   >
   >     0156.00   +'
   >     xmlns:SOAP-ENV="[1][3]http://schemas.xmlsoap.org/soap/envelope/";'
   >     0157.00   +'    xmlns:web="[2][4]http://websvcs.otswebws";>'
   >
   >     0158.00   +'<SOAP-ENV:Header>'
   >
   >     0159.00   +'    <wsse:Security SOAP-ENV:mustUnderstand="1"'
   >
   >     0160.00   +'
   >
   xmlns:wsse="[3][5]http://docs.oasis-open.org/wss/2004/01/oasis-200401-'
   >     0161.00   +'wss-wssecurity-secext-1.0.xsd">'
   >
   >     0162.00   +'    <wsu:Timestamp wsu:Id="Timestamp-6"'
   >
   >     0163.00   +'
   >
   xmlns:wsu="[4][6]http://docs.oasis-open.org/wss/2004/01/oasis-200401'
   >     0164.00   +'-wss-wssecurity-utility-1.0.xsd">'
   >
   >     0165.00   +'
   >     <wsu:Created>'+createdate+'T'+createtime+'Z</wsu:Created>'
   >     0166.00   +'
   >     <wsu:Expires>'+expiredate+'T'+expiretime+'Z</wsu:Expires>'
   >     0167.00   +'    </wsu:Timestamp>'
   >
   >     0168.00   +'    <wsse:UsernameToken wsu:Id="UsernameToken-5"
   xmlns:wsu'
   >
   >     0169.00
   +'="[5][7]http://docs.oasis-open.org/wss/2004/01/oasis-200401-'
   >
   >     0170.00   +'wss-wssecurity-utility-1.0.xsd">'
   >
   >     0171.00   +'    <wsse:Username>XXXXXXXXXX</wsse:Username>'
   >
   >     0172.00   +'    <wsse:Password
   Type="[6][8]http://docs.oasis-open.org/wss'
   >
   >     0173.00   +'/2004/01/oasis-200401-wss-username-token-profile-1.0'
   >
   >     0174.00   +'#PasswordText">XXXXXXXXXX</wsse:Password>'
   >
   >     0175.00   +'    <wsse:Nonce
   >     EncodingType="[7][9]http://docs.oasis-open.org/'
   >     0176.00   +'wss/2004/01/oasis-200401-wss-soap-message-security-'
   >
   >     0177.00   //+'1.0#Base64Binary">Qcw0k1jjcEvvrNldT3ex1A==</wsse:'
   >
   >     0178.00   +'1.0#Base64Binary">'+token64+'</wsse:'
   >
   >     0179.00   +'Nonce>'
   >
   >     0180.00   +'
   >     <wsu:Created>'+createdate+'T'+createtime+'Z</wsu:Created>'
   >     0181.00   +'    </wsse:UsernameToken>'
   >
   >     0182.00   +'    </wsse:Security>'
   >
   >     0183.00   +'</SOAP-ENV:Header>'
   >
   >     0184.00   +'<SOAP-ENV:Body>'
   >
   >     0185.00   +'    <web:dequeue2>'
   >
   >     0186.00   +'         <subscriberId>3</subscriberId>'
   >
   >     0187.00   +'         <transactionIdIn>0</transactionIdIn>'
   >
   >     0188.00   +'    </web:dequeue2>'
   >
   >     0189.00   +'</SOAP-ENV:Body>'
   >
   >     0190.00   +'</SOAP-ENV:Envelope>';
   >
   >     0191.00
   >
   >     0192.00   http_debug(*ON);
   >
   >     0193.00
   >
   >     0194.00     soapfile = '/tmp/OmniTracsFuelRaw.soap';
   >
   >     0195.00
   >
   >     0196.00     rc = http_url_post(
   >
   >     0197.00
   >
   >     0198.00
   >     'https://services.omnitracs.com:443/otsWebWS/services/OTSWebSvcs'
   >     0199.00                     : %addr(SOAP) + 2
   >
   >     0200.00                     : %len(SOAP)
   >     0201.00                     : soapfile
   >     0202.00                     : HTTP_TIMEOUT
   >     0203.00                     : HTTP_USERAGENT
   >     0204.00                     : 'text/xml'
   >     0205.00                     : 'ETS Test');
   >     0206.00
   >     0207.00   if (rc <> 1);
   >     0208.00      unlink(soapfile);
   >     0209.00      http_crash();
   >     0210.00   endif;
   >     0211.00
   >     0212.00   // ----------------------------------------------
   >     0213.00   //   The response from the server will be in
   >     0214.00   //   the IFS in a file with a unique name.
   >     0215.00   //   that IFS filename is in the "tempfile"
   >     0216.00   //   variable at this point.
   >     0217.00   //
   >     0218.00   //   For debugging purposes, display the
   >     0219.00   //   contents of that file, now.
   >     0220.00   // ----------------------------------------------
   >     0221.00  /if defined(DEBUGGING)
   >     0222.00      dsply ('Press <ENTER> to see SOAP response') ' '
   wait;
   >     0223.00      cmd = 'DSPF STMF(''' + soapfile + ''')';
   >     0224.00      QCMDEXC(cmd: %len(cmd));
   >     0225.00  /endif
   >     0226.00
   >     0227.00    // ----------------------------------------------
   >     0228.00    //  Parse the SOAP document (the one in soapfile)
   >     0229.00    //  Inside it will be another XML document that's
   >     0230.00    //  embedded within -- save that to a separate
   >     0231.00    //  file in the IFS.
   >     0232.00    // ----------------------------------------------
   >     0233.00
   >     0234.00      embfile = '/tmp/OmniTracsFuelFin.soap';
   >     0235.00
   >     0236.00      if (http_parse_xml_stmf( soapfile
   >     0237.00                             : HTTP_XML_CALC
   >     0238.00                             : *null
   >     0239.00                             : %paddr(SaveEmbed)
   >     0240.00                             : %addr(embfile) ) < 0);
   >     0241.00          callp close(fd);
   >     0242.00          unlink(soapfile);
   >     0243.00          unlink(embfile);
   >     0244.00          http_crash();
   >     0245.00      endif;
   >     0246.00
   >     0247.00      unlink(soapfile);
   >     0248.00
   >     0249.00    // ----------------------------------------------
   >     0250.00    //   For the sake of debugging, display the
   >     0251.00    //   contents of the embedded XML document
   >     0252.00    //   (Remove from production code)
   >     0253.00    // ----------------------------------------------
   >     0254.00
   >     0255.00  /if defined(DEBUGGING)
   >     0256.00      dsply ('Press <ENTER> to see extracted XML') ' '
   wait;
   >     0257.00      cmd = 'DSPF STMF(''' + embfile + ''')';
   >     0258.00      QCMDEXC(cmd: %len(cmd));
   >     0259.00  /endif
   >     0260.00
   >     0261.00    // ----------------------------------------------
   >     0262.00    //    Parse the second XML document (the one
   >     0263.00    //    that was embedded)
   >     0264.00    // ----------------------------------------------
   >     0265.00      fuel = *allx'00';
   >     0266.00      if (http_parse_xml_stmf( embfile
   >     0267.00                             : HTTP_XML_CALC
   >     0268.00                             : *null
   >     0269.00                             : %paddr(Embedded)
   >     0270.00                             : %addr(fuel) ) < 0);
   >     0271.00          unlink(embfile);
   >     0272.00          http_crash();
   >     0273.00      endif;
   >     0274.00
   >     0275.00
   >     0276.00   *inlr = *on;
   >     0277.00
   >     0278.00  /end-free
   >     0279.00
   >     0280.00 P SaveEmbed       B
   >     0281.00 D SaveEmbed       PI
   >     0282.00 D   embfile                     50a   varying
   >     0283.00 D   depth                       10I 0 value
   >     0284.00 D   name                      1024A   varying const
   >     0285.00 D   path                     24576A   varying const
   >     0286.00 D   value                    32767A   varying const
   >     0287.00 D   attrs                         *   dim(32767)
   >     0288.00 D                                     const
   options(*varsize)
   >     0289.00
   >     0290.00 D writeConst      PR            10I 0 ExtProc('write')
   >     0291.00 D  fildes                       10i 0 value
   >     0292.00 D  buf                       65535A   const
   options(*varsize)
   >     0293.00 D  bytes                        10U 0 value
   >     0294.00
   >     0295.00 D xmlhdr          s             80a   varying
   >     0296.00 D fd              s             10i 0
   >     0297.00
   >     0298.00  /free
   >     0299.00  //    if (name <> 'GetABADetailsByRoutingNumberResult');
   >     0300.00  //      return;
   >     0301.00  //    endif;
   >     0302.00
   >     0303.00       // ------------------------------------------
   >     0304.00       //   create new stream file in IFS
   >     0305.00       //   tag it with CCSID 1208 (UTF-8)
   >     0306.00       // ------------------------------------------
   >     0307.00
   >     0308.00       unlink(embfile);
   >     0309.00       fd = open(embfile: O_CREAT+O_CCSID+O_WRONLY
   >     0310.00                        : S_IRUSR + S_IWUSR: 819);
   >     0311.00       callp close(fd);
   >     0312.00
   >     0313.00       // ------------------------------------------
   >     0314.00       //    Open stream file for appending data
   >     0315.00       //    and write embedded XML document to it
   >     0316.00       // ------------------------------------------
   >     0317.00
   >     0318.00       fd = open(embfile: O_WRONLY+O_TEXTDATA);
   >     0319.00
   >     0320.00       xmlhdr= '<?xml version="1.0" encoding="UTF-8"?>' +
   >     x'0d25';
   >     0321.00       writeConst(fd: xmlhdr: %len(xmlhdr));
   >
   >     0322.00       writeConst(fd: value:  %len(value));
   >
   >     0323.00
   >
   >     0324.00       callp close(fd);
   >
   >     0325.00  /end-free
   >
   >     0326.00 P                 E
   >
   >     0327.00
   >
   >     0328.00
   >
   >     0329.00 P embedded        B
   >
   >     0330.00 D embedded        PI
   >
   >     0331.00 D   fuel                              likeds(fuel_t)
   >
   >     0332.00 D   depth                       10I 0 value
   >
   >     0333.00 D   name                      1024A   varying const
   >
   >     0334.00 D   path                     24576A   varying const
   >
   >     0335.00 D   value                    32767A   varying const
   >
   >     0336.00 D   attrs                         *   dim(32767)
   >
   >     0337.00 D                                     const
   options(*varsize)
   >
   >     0338.00
   >
   >     0339.00  /free
   >
   >     0340.00     select;
   >     0341.00     when name = 'vehicleID';
   >     0342.00        fuel.vehicle = %trimr(value);
   >     0343.00     when name = 'driverName';
   >     0344.00        fuel.driver = %trimr(value);
   >     0345.00     when name = 'companyName';
   >     0346.00        fuel.comp = %trimr(value);
   >     0347.00     endsl;
   >     0348.00  /end-free
   >     0349.00 P                 E
   >     Here are my results as seen in step 221.00:
   >      ************Beginning of data**************
   >
   >     <soapenv:Envelope
   >     xmlns:soapenv="[8][10]http://schemas.xmlsoap.org/soap/envelope/";
   >     xmlns:soapenc="[9][11]http://schemas.xmlsoap.org/soap/encoding/
   >     " xmlns:xsd="[10][12]http://www.w3.org/2001/XMLSchema";
   >
   xmlns:xsi="[11][13]http://www.w3.org/2001/XMLSchema-instance";><soapenv:
   Head
   >     er/><soapenv:Body>
   >     <p917:dequeue2Response
   >
   xmlns:p917="[12][14]http://websvcs.otswebws";><dequeue2Return><count>1</
   coun
   >     t><transactions>PD94bWwgdmVyc2lvbj0iMS4wIi
   >
   BlbmNvZGluZz0iVVRGLTgiPz48dHJhbkJsb2NrPjx0cmFuIElEPSI0ODQ5MTgiIGNvbXBhb
   >     nlJRD0iRkFSTkVSQk9DSyIgYXV4SUQ9IjA1NDYwNTk4MjQiPjxULjIuUk0wMS
   >
   4wPjxldmVudFRTPjIwMTUtMDktMjJUMjE6MzM6MDZaPC9ldmVudFRTPjxlcXVpcG1lbnQgS
   >     UQ9IkJBR1VOSVQiIGVxdWlwVHlwZT0idHJhY3RvciIgdW5pdEFkZHJlc3M9Ij
   >
   AxMDcwNTI2OTAiIG1vYmlsZVR5cGU9IjgiLz48ZHJpdmVySUQ+VFJBSU5FUjwvZHJpdmVyS
   >     UQ+PHBvc2l0aW9uIGxvbj0iLTk0LjgzNzU5MiIgbGF0PSI0Mi4wNjYwMTgiIH
   >
   Bvc1RTPSIyMDE1LTA5LTIyVDE0OjU0OjIyWiIvPjxwb3NUeXBlPjM8L3Bvc1R5cGU+PGlnb
   >     ml0aW9uU3RhdHVzPjE8L2lnbml0aW9uU3RhdHVzPjx0cmlwU3RhdHVzPk88L3
   >
   RyaXBTdGF0dXM+PEdNSD4wMDEwMTgwMzE8L0dNSD48cmVjZWl2ZWRUUz4yMDE1LTA5LTIyV
   >     DIxOjM2OjU2WjwvcmVjZWl2ZWRUUz48bXNnUHJpb3JpdHk+MDwvbXNnUHJpb3
   >
   JpdHk+PG1hY3JvQm9keT48bWFjcm9UeXBlIGRpcmVjdGlvbj0iUiIgbnVtYmVyPSIxIiB2Z
   >     XJzaW9uPSIyIj5UUlVDSyBGVUVMPC9tYWNyb1R5cGU+PG1hY3JvRmllbGQgZG
   >
   ljdFRhZz0idmVoaWNsZUlkIj5CMDE8L21hY3JvRmllbGQ+PG1hY3JvRmllbGQgZGljdFRhZ
   >     z0iZHJpdmVyTmFtZSI+QklMTFkgQk9CPC9tYWNyb0ZpZWxkPjxtYWNyb0ZpZW
   >
   xkIGRpY3RUYWc9ImNvbXBhbnlOYW1lIj5TUEFSS1lTIENBUlJPTEw8L21hY3JvRmllbGQ+P
   >     G1hY3JvRmllbGQgZGljdFRhZz0ic3RhdGUiPklBPC9tYWNyb0ZpZWxkPjxtYW
   >
   Nyb0ZpZWxkIGRpY3RUYWc9ImdhbGxvbnMiPjUwPC9tYWNyb0ZpZWxkPjxtYWNyb0ZpZWxkI
   >     GRpY3RUYWc9ImNvc3Qgb2YgZnVlbCI+MjAwLjAwPC9tYWNyb0ZpZWxkPjxtYW
   >
   Nyb0ZpZWxkIGRpY3RUYWc9IndlaWdodCI+NTAwPC9tYWNyb0ZpZWxkPjwvbWFjcm9Cb2R5P
   >     jwvVC4yLlJNMDEuMD48L3RyYW4+PC90cmFuQmxvY2s+</transactions><tr
   >
   ansactionIdOut>484918</transactionIdOut></dequeue2Return></p917:dequeue
   >     2Response></soapenv:Body></soapenv:Envelope>
   >      ************End of Data********************
   >     My results as seen in step 255.00
   >      ************Beginning of data**************
   >     <?xml version="1.0" encoding="UTF-8"?>
   >      ************End of Data********************
   >     When I move on to the next step, I get "XML parse failed at line
   2, col
   >     0, element not found."  What am I missing?
   >     Thanks for the feedback.
   >
   >     Corby Weaver
   >     From:        Mike Krebs <mkrebs@xxxxxxxxxxxxxxxxxx>
   >     To:        HTTPAPI and FTPAPI Projects
   <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>,
   >     Date:        12/07/2015 10:37 AM
   >     Subject:        RE: New to XML - Dequeue2 Request Issue
   >     Sent by:        ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   >
   > __________________________________________________________________
   >
   >     Nothing stands out to me...you never explained how and where "I'm
   >     having an issue".
   >     Post debug. Make sure to scrub proprietary or confidential
   information.
   >     -----Original Message-----
   >     From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   >     [[13][15]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf
   Of
   >     corby.weaver@xxxxxxxxxxxxxxxxx
   >     Sent: Wednesday, December 2, 2015 10:50 AM
   >     To: HTTPAPI and FTPAPI Projects
   >     Subject: RE: New to XML - Dequeue2 Request Issue
   >       I've got my initial file coming in fine (Step 1).  I'm having
   an
   >     issue
   >       with Step 2, parsing the "real" data.
   >       Here is my code:
   >           soapfile = '/tmp/OmniTracsFuelRaw.soap';
   >           rc = http_url_post(
   >
   >     'https://services.omnitracs.com:443/otsWebWS/services/OTSWebSvcs'
   >                           : %addr(SOAP) + 2
   >                           : %len(SOAP)
   >                           : soapfile
   >                           : HTTP_TIMEOUT
   >                           : HTTP_USERAGENT
   >                           : 'text/xml'
   >                           : 'ETS Test');
   >         if (rc <> 1);
   >            unlink(soapfile);
   >            http_crash();
   >         endif;
   >         // ----------------------------------------------
   >         //   The response from the server will be in
   >         //   the IFS in a file with a unique name.
   >         //   that IFS filename is in the "tempfile"
   >         //   variable at this point.
   >         //
   >         //   For debugging purposes, display the
   >         //   contents of that file, now.
   >         // ----------------------------------------------
   >          // ----------------------------------------------
   >          //  Parse the SOAP document (the one in soapfile)
   >          //  Inside it will be another XML document that's
   >          //  embedded within -- save that to a separate
   >          //  file in the IFS.
   >          // ----------------------------------------------
   >            embfile = '/tmp/OmniTracsFuelFin.soap';
   >            if (http_parse_xml_stmf( soapfile
   >                                   : HTTP_XML_CALC
   >                                   : *null
   >                                   : %paddr(SaveEmbed)
   >                                   : %addr(embfile) ) < 0);
   >                callp close(fd);
   >                unlink(soapfile);
   >                unlink(embfile);
   >                http_crash();
   >            endif;
   >            unlink(soapfile);
   >       Anything stand out?  Thoughts and suggestions are appreciated.
   >       Thanks!
   >       Corby Weaver
   >       From:        Mike Krebs <mkrebs@xxxxxxxxxxxxxxxxxx>
   >       To:        HTTPAPI and FTPAPI Projects
   >     <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>,
   >       Date:        11/20/2015 05:09 PM
   >       Subject:        RE: New to XML - Dequeue2 Request Issue
   >       Sent by:        ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   >
   __________________________________________________________________
   >       Let's break the project into steps:
   >       1. Send request and receive response
   >       2. Parse the IFS file saving the "real" data
   >       3. Decode the "real" data
   >       4. Parse the "real" data
   >       See Example17 for 1, 2, and 4. To decode see Scott's Base64 or
   the
   >       built-in support in OS400.
   >       Alternatively, use WSDL2RPG as in the linked thread to do what
   you
   >       need. It is a little harder to understand initially but it will
   >       generate programs for you to modify for the service. Depending
   on the
   >       WSDL, it might do everything you need.
   >       -----Original Message-----
   >       From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   >       [[1][14][16]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On
   Behalf Of
   >       corby.weaver@xxxxxxxxxxxxxxxxx
   >       Sent: Friday, November 20, 2015 1:05 PM
   >       To: HTTPAPI and FTPAPI Projects
   >       Subject: Re: New to XML - Dequeue2 Request Issue
   >         Sorry, it is encoded, not encrypted.  There was a similar
   post a
   >     few
   >         years ago where the transaction portion of the XML document
   was
   >       parsed
   >         and I assume the base64 decoder worked.  Being unfamiliar
   with XML,
   >     I
   >         do not know what the code should be for my specific program.
   >         Here is a link to the previous thread...
   >
   >
   [1][2][15][17]https://scottklement.com/archives/ftpapi/201210/msg00121.
   html
   >         I'm hoping someone is able to help me with the portion of
   code that
   >         does the parse.
   >         Thanks,
   >         Corby Weaver
   >       References
   >         1.
   >
   >
   [3][16][18]https://scottklement.com/archives/ftpapi/201210/msg00121.htm
   l
   >
   >
   -----------------------------------------------------------------------
   >       This is the FTPAPI mailing list.  To unsubscribe, please go to:
   >       [4][17][19]http://www.scottklement.com/mailman/listinfo/ftpapi
   >
   >
   >
   ----------------------------------------------------------------------
   > -
   >
   >
   -----------------------------------------------------------------------
   >       This is the FTPAPI mailing list.  To unsubscribe, please go to:
   >       [5][18][20]http://www.scottklement.com/mailman/listinfo/ftpapi
   >
   >
   -----------------------------------------------------------------------
   >     References
   >       1. [19][21]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   >       2.
   [20][22]https://scottklement.com/archives/ftpapi/201210/msg00121.html
   >       3.
   [21][23]https://scottklement.com/archives/ftpapi/201210/msg00121.html
   >       4. [22][24]http://www.scottklement.com/mailman/listinfo/ftpapi
   >       5. [23][25]http://www.scottklement.com/mailman/listinfo/ftpapi
   >
   -----------------------------------------------------------------------
   >     This is the FTPAPI mailing list.  To unsubscribe, please go to:
   >     [24][26]http://www.scottklement.com/mailman/listinfo/ftpapi
   >
   -----------------------------------------------------------------------
   >
   -----------------------------------------------------------------------
   >     This is the FTPAPI mailing list.  To unsubscribe, please go to:
   >     [25][27]http://www.scottklement.com/mailman/listinfo/ftpapi
   >
   >
   ----------------------------------------------------------------------
   > -
   >
   > References
   >
   >     1. [28]http://schemas.xmlsoap.org/soap/envelope/
   >     2. [29]http://websvcs.otswebws/
   >     3. [30]http://docs.oasis-open.org/wss/2004/01/oasis-200401-'
   >     4. [31]http://docs.oasis-open.org/wss/2004/01/oasis-200401'
   >     5. [32]http://docs.oasis-open.org/wss/2004/01/oasis-200401-'
   >     6. [33]http://docs.oasis-open.org/wss'
   >     7. [34]http://docs.oasis-open.org/'
   >     8. [35]http://schemas.xmlsoap.org/soap/envelope/
   >     9. [36]http://schemas.xmlsoap.org/soap/encoding/
   >    10. [37]http://www.w3.org/2001/XMLSchema
   >    11. [38]http://www.w3.org/2001/XMLSchema-instance
   >    12. [39]http://websvcs.otswebws/
   >    13. [40]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   >    14. [41]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   >    15.
   [42]https://scottklement.com/archives/ftpapi/201210/msg00121.html
   >    16.
   [43]https://scottklement.com/archives/ftpapi/201210/msg00121.html
   >    17. [44]http://www.scottklement.com/mailman/listinfo/ftpapi
   >    18. [45]http://www.scottklement.com/mailman/listinfo/ftpapi
   >    19. [46]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   >    20.
   [47]https://scottklement.com/archives/ftpapi/201210/msg00121.html
   >    21.
   [48]https://scottklement.com/archives/ftpapi/201210/msg00121.html
   >    22. [49]http://www.scottklement.com/mailman/listinfo/ftpapi
   >    23. [50]http://www.scottklement.com/mailman/listinfo/ftpapi
   >    24. [51]http://www.scottklement.com/mailman/listinfo/ftpapi
   >    25. [52]http://www.scottklement.com/mailman/listinfo/ftpapi
   >
   ----------------------------------------------------------------------
   > - This is the FTPAPI mailing list.  To unsubscribe, please go to:
   > [53]http://www.scottklement.com/mailman/listinfo/ftpapi
   >
   ----------------------------------------------------------------------
   > -
   >
   >
   >
   > -----
   > No virus found in this message.
   > Checked by AVG - [54]www.avg.com
   > Version: 2015.0.6176 / Virus Database: 4483/11157 - Release Date:
   > 12/11/15
   -----------------------------------------------------------------------
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   [55]http://www.scottklement.com/mailman/listinfo/ftpapi
   -----------------------------------------------------------------------
   -----------------------------------------------------------------------
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   [56]http://www.scottklement.com/mailman/listinfo/ftpapi
   -----------------------------------------------------------------------
   -----------------------------------------------------------------------
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   [57]http://www.scottklement.com/mailman/listinfo/ftpapi
   -----------------------------------------------------------------------

References

   1. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   2. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   3. http://schemas.xmlsoap.org/soap/envelope/
   4. http://websvcs.otswebws/
   5. http://docs.oasis-open.org/wss/2004/01/oasis-200401-'
   6. http://docs.oasis-open.org/wss/2004/01/oasis-200401'
   7. http://docs.oasis-open.org/wss/2004/01/oasis-200401-'
   8. http://docs.oasis-open.org/wss'
   9. http://docs.oasis-open.org/'
  10. http://schemas.xmlsoap.org/soap/envelope/
  11. http://schemas.xmlsoap.org/soap/encoding/
  12. http://www.w3.org/2001/XMLSchema
  13. http://www.w3.org/2001/XMLSchema-instance
  14. http://websvcs.otswebws/
  15. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  16. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  17. https://scottklement.com/archives/ftpapi/201210/msg00121.html
  18. https://scottklement.com/archives/ftpapi/201210/msg00121.html
  19. http://www.scottklement.com/mailman/listinfo/ftpapi
  20. http://www.scottklement.com/mailman/listinfo/ftpapi
  21. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  22. https://scottklement.com/archives/ftpapi/201210/msg00121.html
  23. https://scottklement.com/archives/ftpapi/201210/msg00121.html
  24. http://www.scottklement.com/mailman/listinfo/ftpapi
  25. http://www.scottklement.com/mailman/listinfo/ftpapi
  26. http://www.scottklement.com/mailman/listinfo/ftpapi
  27. http://www.scottklement.com/mailman/listinfo/ftpapi
  28. http://schemas.xmlsoap.org/soap/envelope/
  29. http://websvcs.otswebws/
  30. http://docs.oasis-open.org/wss/2004/01/oasis-200401-'
  31. http://docs.oasis-open.org/wss/2004/01/oasis-200401'
  32. http://docs.oasis-open.org/wss/2004/01/oasis-200401-'
  33. http://docs.oasis-open.org/wss'
  34. http://docs.oasis-open.org/'
  35. http://schemas.xmlsoap.org/soap/envelope/
  36. http://schemas.xmlsoap.org/soap/encoding/
  37. http://www.w3.org/2001/XMLSchema
  38. http://www.w3.org/2001/XMLSchema-instance
  39. http://websvcs.otswebws/
  40. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  41. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  42. https://scottklement.com/archives/ftpapi/201210/msg00121.html
  43. https://scottklement.com/archives/ftpapi/201210/msg00121.html
  44. http://www.scottklement.com/mailman/listinfo/ftpapi
  45. http://www.scottklement.com/mailman/listinfo/ftpapi
  46. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
  47. https://scottklement.com/archives/ftpapi/201210/msg00121.html
  48. https://scottklement.com/archives/ftpapi/201210/msg00121.html
  49. http://www.scottklement.com/mailman/listinfo/ftpapi
  50. http://www.scottklement.com/mailman/listinfo/ftpapi
  51. http://www.scottklement.com/mailman/listinfo/ftpapi
  52. http://www.scottklement.com/mailman/listinfo/ftpapi
  53. http://www.scottklement.com/mailman/listinfo/ftpapi
  54. file://localhost/tmp/www.avg.com
  55. http://www.scottklement.com/mailman/listinfo/ftpapi
  56. http://www.scottklement.com/mailman/listinfo/ftpapi
  57. http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------