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

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