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

RE: Base64



   Thanks for answer!
   I fant the program missing http_xmlReturnPtr(*ON); The program works
   now.
   UPS uses fowllowing to send label.


   Accept response consist of two parts, both of which are base64 encoded
   data which must be decoded. Part one consists of the label image and
   part two contains the HTML which is used to properly size the label
   image in a browser for display and printing. When the two parts are
   combined they form a unit which will satisfy the requirements for
   printing a proper label to apply to a package. This ensures the label
   will meet the standards necessary for UPS to scan and process the
   label within the shipping system.

   Does anyone know how to make UPS-label to be able for display and
   printing?
   Best regards
   Y. B. Chang

   "Porterfield, Sean" <SPorterfield@xxxxxxxxxxxxxxxxxxxxxxx>
   Sent by: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx

   09.06.2011 14:40

                             Please respond to
        HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>

                                                                       To

   HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>

                                                                       cc

                                                                  Subject

   RE: Base64

   Maybe I missed it, but I don't see where you assigned value.buf or
   value.len; indeed your debug values support my interpretation.
   --
   Sean Porterfield
   -----Original Message-----
   From: Y. B. Chang
   Sent: Thursday, June 09, 2011 06:40
   To: HTTPAPI and FTPAPI Projects
   Subject: Re: R: Base64
   Hello,
   Thanks for help!
   It works. But new problem comes again. When I starter the program, I
   debug the program before and after base64_decode.
   Before:
   value
   VALUE.BUF = SPP:*NULL
   VALUE.LEN = -1998265372
   After (get error message):
   Receiver value too small to hold result.
   My program is here.
   H DFTACTGRP(*NO) BNDDIR('HTTPAPI':'BASE64')
   /copy qrpglesrc,httpapi_h
   /copy qrpglesrc,ifsio_h
   /copy qrpglesrc,base64_h
   D GetInnerDoc     PR
   D   filename                    50a   varying
   D   depth                       10I 0 value
   D   name                      1024A   varying const
   D   path                     24576A   varying const
   D   value                             likeds(Element_Val_t)
   D   Attrs                         *   dim(32767)
   D                                     const options(*varsize)
   D filename1       s             50A   varying
   D filename        s             50A   varying
   D Element_Val_t   ds                  qualified
   D   buf                           *
   D   len                         10I 0
   C                   EVAL      filename1 = '/tmp/ups/UPS0057090.xml'
   C                   EVAL      filename  = '/tmp/ups/UPS0057090.gif'
   /free
     *inlr = *on;
   if (http_parse_xml_stmf( filename1
                         : HTTP_XML_CALC
                         : *null
                         : %paddr(GetInnerDoc)
                         : %addr(filename)) <0 );
     return;
   endif;
   /end-free
   P GetInnerDoc     B                   export
   D GetinnerDoc     PI
   D   filename                    50a   varying
   D   depth                       10I 0 value
   D   name                      1024A   varying const
   D   path                     24576A   varying const
   D   value                             likeds(Element_Val_t)
   D   attrs                         *   dim(32767)
   D                                     const options(*varsize)
   D fd              s             10i 0
   D outbuf          S          64576A
   D outlen          S             10I 0
   /free
        select;
        when name = 'ship:GraphicImage';
        fd = open(filename
                 : O_CREAT + O_TRUNC + O_WRONLY + O_CCSID
                   + O_TEXTDATA + O_TEXT_CREAT
                 : S_IRUSR + S_IWUSR
                 : 819
                 : 0 );
        outlen = base64_decode( value.buf
                              : value.len
                              : %addr(outbuf)
                              : %size(outbuf) );
         callp write(fd: %addr(outbuf): outlen);
         callp close(fd);
         endsl;
   /end-free
   P                 E
   Best regards
   Y. B. Chang
   Scott Klement <sk@xxxxxxxxxxxxxxxx>
   Sent by: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   08.06.2011 18:41
   Please respond to
   HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
   To
   ftpapi@xxxxxxxxxxxxxxxxxxxxxx
   cc
   Subject
   Re: R: Base64
   Hello,
   If this GetInnerDoc is supposed to be called by HTTPAPI's XML parser,
   then Element_Val_t is defined wrong.  It should be defined like this:
      D Element_Val_t   ds                  qualified
      D   buf                           *
      D   len                         10i 0
   On 6/8/2011 9:26 AM, Bing@xxxxxxxxxx wrote:
   >
   >     Hi Luciano
   >     I get a new problem now. I try to make as descripted in Parse
   innerxml
   >     in base64 format.
   >     >  P GetInnerDoc     B                   export
   >     >  D GetInnerDoc     PI
   >     >  D   filename                    50a   varying
   >     >  D   depth                       10I 0 value
   >     >  D   name                      1024A   varying const
   >     >  D   path                     24576A   varying const
   >     >  D   value                             likeds(Element_Val_t)
   >     >  D   Attrs                         *   dim(32767)
   >     >  D                                     const options(*varsize)
   >     >  D fd              s             10i 0
   >     >  D fd3             s             10I 0
   >     >  D len             s             10I 0
   >     >  D buf             s          32768A
   >     >  D outbuf          S          24576A
   >     >  D outlen          S             10I 0
   >     >
   >     >   /free
   >     >
   >     >     if path = '/soapenv:Envelope/soapenv:Body/'
   >     >             + 'rs:getContentResponse';
   >     >       if (name = 'content:content');
   >     >         fd = open( filename
   >     >                   : O_CREAT + O_TRUNC + O_WRONLY + O_CCSID
   >     >                     + O_TEXTDATA + O_TEXT_CREAT
   >     >                   : S_IRUSR + S_IWUSR
   >     >                   : 819
   >     >                   : 0 );
   >     >         // FIXME: Add error handling.
   >     >
   >     >         outlen = base64_decode( value.buf
   >     >                   : value.len
   >     >                   : %addr(outbuf)
   >     >                   : %size(outbuf) );
   >     >
   >     >         callp write(fd: %addr(outbuf): outlen);
   >     >
   >     >         callp close(fd);
   >     >       endif;
   >     >     endif;
   >     >   /end-free
   >     >  P                 E
   >     Element_Val_t is not defined. I defined this on top of my
   program.
   >     D Element_Val_t   ds                  qualified
   >     D   data                          *
   >     D   buf                      32768A
   >     D   len                         10i 0
   >     When I compile my program, I get error message.
   >     *RNF7536 30   3125 028300  The type of parameter 1 specified for
   the
   >     call does not
   >                                match the prototype.
   >
   >     Parameter 1 is value.buf.
   >     Can you help me with this?
   >     Best regards
   >     Y. B. Chang
   This email is confidential, intended only for the named recipient(s)
   above and may contain information that is privileged.  If you have
   received this message in error or are not the named recipient(s),
   please notify the sender immediately and delete this email message
   from your computer as any and all unauthorized distribution or use of
   this message is strictly prohibited.  Thank you.
   ----------------------------------------------------------------------
   -
   This is the FTPAPI mailing list.  To unsubscribe, please go to:
   [1]http://www.scottklement.com/mailman/listinfo/ftpapi
   ----------------------------------------------------------------------
   -

References

   1. 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
-----------------------------------------------------------------------