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

RE: Save File Stream As .tif Image



How is your ability to download and view any other .tif?

If you want to try, here is a short program to download a .tif to /tmp/ccitt_1.tif
H DFTACTGRP(*NO) BNDDIR('HTTPAPI')                                     
                                                                       
 /copy qrpglesrc,httpapi_h                                             
                                                                       
D rc              s             10I 0                                  
D msg             s             52A                                    
D URL             S            300A    varying                         
D IFS             S            256A    varying                         
D errNo           S             10i 0                                  
D retries         S             10i 0                                  
                                                                       
c                   callp     http_debug(*ON)                          
                                                                       
c                   eval      URL = 'http://www.fileformat.info'       
c                                 + '/format/tiff/sample/'             
c                                 + '3794038f08df403bb446a97f897c578d/'
c                                 + 'download'                         
                                                                       
c                   eval      IFS = '/tmp/ccitt_1.tif'                 
                                                                       
c                   eval      rc = http_url_get(URL: IFS : 5)          
  if rc = 302;                                                         
    rc = http_url_get(http_redir_loc: ifs);                            
 /copy qrpglesrc,httpapi_h                                             
                                                                       
D rc              s             10I 0                                  
D msg             s             52A                                    
D URL             S            300A    varying                         
D IFS             S            256A    varying                         
D errNo           S             10i 0                                  
D retries         S             10i 0                                  
                                                                       
c                   callp     http_debug(*ON)                          
                                                                       
c                   eval      URL = 'http://www.fileformat.info'       
c                                 + '/format/tiff/sample/'             
c                                 + '3794038f08df403bb446a97f897c578d/'
c                                 + 'download'                         
                                                                       
c                   eval      IFS = '/tmp/ccitt_1.tif'                 
                                                                       
c                   eval      rc = http_url_get(URL: IFS : 5)          
  if rc = 302;                                                         
    rc = http_url_get(http_redir_loc: ifs);                            
  endif;                                                               
                                                                       
c                   if        rc <> 1                                  
c                   eval      retries = 0                              
c                   eval      msg = http_error(errNo)                  
c                   dow       errNo = 7 and retries < 5                
c                   callp     http_dmsg('rc= ' + %char(rc))            
c                   callp     http_dmsg('retries= ' + %char(retries))  
c                   eval      rc = http_url_get(URL: IFS : 5)          
c                   if        rc = 1                                   
c                   eval      retries = *hival                         
c                   else                                               
c                   eval      msg = http_error(errNo)                  
c                   eval      retries += 1                             
c                   endif                                              
c                   enddo                                              
c                   endif                                              
                                                                       
c                   eval      *inlr = *on                              

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Thomas Raddatz
Sent: Tuesday, June 2, 2015 12:42 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: Save File Stream As .tif Image

Paul,

What kind of stream do you get back. Is the the binary image stream or is it an XML message with the image data as part of an xml element?

I assume that you get back an XML message. So how is the binary image data encoded? Base64? Something else?

Can you provide a sample response message? You may shorten the image data if it is to big. Just include, let's say, the first 30 and last 30 bytes of the image data.

Thomas.

Am 02.06.2015 um 13:31 schrieb Paul Park:
> Hi
> 
> The HTTPAPI service programs are working a treat for us, but I have 
> run into a problem.
> 
> I am using http_url_post_xml to post an XML request containing an ID. 
> The response I get back contains the "file stream" for a .tif image. I 
> want to save this data in a .tif file, in the IFS, so that when I open 
> it I can see the image. The image is destined for display on a web 
> page. So far, I can save the file stream in example.tif but it doesn't open as an image.
> 
> I don't think this is specifically a HTTPAPI problem, but does anyone 
> know what I need to do to save the file stream properly as a .tif image?
> 
> Thanks for any assistance.
> 
> Cheers,
> Paul
> 
> 
> Enterprise Software Systems.
> Company No 3374336. Registered in England, Registered Office: 
> Enterprise House, Pacific Road Altrincham, Cheshire, WA14 5EN
> 
> The information in this email is confidential and may be legally 
> privileged. It is intended solely for the addressee. Access to this 
> email by anyone else is unauthorized. If you are not the intended 
> recipient, any disclosure, copying, distribution or any action taken 
> or omitted to be taken in reliance on it, is prohibited and may be 
> unlawful. If you are not the intended addressee please contact the 
> sender and dispose of this e-mail.
> 
> 
> ----------------------------------------------------------------------
> - This is the FTPAPI mailing list.  To unsubscribe, please go to:
> 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
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------