5 Replies Latest reply: Mar 2, 2012 10:32 AM by Mindmap RSS

    Expose report with images as RESTful webservice

    Mindmap
      Hello friends,

      I have a report to be exposed as RESTful web service. Among the data that is exposed there are 4 images for each record.
      How can I expose the link of those images ???

      I did the following:
      the column that contains the first image "img1" has Blob format, and the image is uploaded normally - through Browse File Item - Storage type: Blob...
      but in the exposed report it shows up as number; as you can see here:
      http://94.200.97.14/apex/apex_rest.getReport?app=101&page=34&reportid=NEW
      I tried to get around using this way:

      The P36_ID item has :
      * default value of SRM_SEQ.NEXTVALE
      * Sequence = 10

      I created three hidden items with default values ( PL/SQL expression )
      '94.200.97.14/img/'||SRM_SEQ.CURRVAL||'/2.jpg'
      '94.200.97.14/img/'||SRM_SEQ.CURRVAL||'/3.jpg'
      '94.200.97.14/*img*/'||SRM_SEQ.CURRVAL||'/4.jpg'

      In the web server there is Folder "img" contains folders which will be named identically as the P36_ID . In each folder there are 3 files: 2.jpg and 3.jpg and 4.jpg

      This way is good... But I do not think that this is the right way to accomplish that task for it does not work unless the end user has access to the server... Any advice ????

      here you can find the report
      http://94.200.97.14/apex/f?p=101:34
      I use Apex 4.1 with the latest version of the listener deployed on glassfish 3.1. Oracle 11g xe. window 7 64 bit machine..

      Regards,
      Fateh
        • 1. Re: Expose report with images as RESTful webservice
          Mindmap
          Hi guys,

          It is kind of urgent thing. Any inputs ????

          Regards,
          Fateh
          • 2. Re: Expose report with images as RESTful webservice
            Mindmap
            Hi guys,
            I did the following:

            In the SQL source of the report on page 34 that I would like to expose I typed:
            Select ..... ,'MY_PUBLIC_IP/apex/'||apex_util.get_blob_file_src('P36_FILE1',s.id) as "img1" from TABLE s
            but the problem is Page 34 is public.
            In other words, If I use the generated Text in the img1 column to get the image in the web service , it will not work...
            Img1 column has values like this:
            http://MY_PUBLIC_IP/apex/apex_util.get_blob_file?>a=101&s=1915954008354848&p=36&d=138855615374945109&i=138852527451945102&p_pk1=84680&p_pk2=&*p_ck*=B6C5A6A3A3F6A4CEF545D>119EBAFD900
            Pls, experts help me ...

            Regards,
            Fateh
            • 3. Re: Expose report with images as RESTful webservice
              fac586
              Fateh wrote:
              Hi guys,
              I did the following:

              In the SQL source of the report on page 34 that I would like to expose I typed:
              Select ..... ,'MY_PUBLIC_IP/apex/'||apex_util.get_blob_file_src('P36_FILE1',s.id) as "img1" from TABLE s
              but the problem is Page 34 is public.
              In other words, If I use the generated Text in the img1 column to get the image in the web service , it will not work...
              Img1 column has values like this:
              http://MY_PUBLIC_IP/apex/apex_util.get_blob_file?>a=101&s=1915954008354848&p=36&d=138855615374945109&i=138852527451945102&p_pk1=84680&p_pk2=&*p_ck*=B6C5A6A3A3F6A4CEF545D>119EBAFD900
              Problem appears to be that the <tt>apex_util.get_blob_file_src('P36_FILE1',s.id)</tt> call references a page item from a page that requires authentication.

              See +{thread:id=698064}+

              Can you modify things to avoid this? The alternative would be to create your own image download procedure operating outside of APEX. This would need to be carefully secured.
              • 4. Re: Expose report with images as RESTful webservice
                Patrick Wolf-Oracle
                Hi Fateh,

                as a workaround: Have you tried to copy your P36_FILE1 page item and your "Fetch Row" process on page 36 to your public page 34? After you have done that set the condition of the page item and the process to "Never" so that they are not rendered/executed. We don't really care anyway, because we just need the meta data of those components to know how to read the BLOB when we reference it in the report.

                I will discuss with my college if we can lift the current security restriction of referencing page items on a protected page.

                Regards
                Patrick
                -----------
                My Blog: http://www.inside-oracle-apex.com
                APEX Plug-Ins: http://apex.oracle.com/plugins
                Twitter: http://www.twitter.com/patrickwolf
                • 5. Re: Expose report with images as RESTful webservice
                  Mindmap
                  Thanks Patrick,

                  Actually I applied that before I sent you.... I found a similar thing on Dimitri's blog:
                  http://dgielis.blogspot.com/2009/05/using-apexutilgetblobfilesrc-on-public.html

                  Now the images show up on the report. But my problem is that I have to expose my report as a web service.
                  In other words, the links of the images should be valid on the XML . e.g:
                  http://fam-erp.com/apex/apex_util.get_blob_file?>a=101&s=2942413019879574&p=36&d=138855615374945109&i=138852527451945102&p_pk1=84705&p_pk2=&p_ck=186FEEDBC8AC88141>401C25DF328BEE8
                  However, I will create a separate work space on my server and post the topic again for I think that I did not make myself clear...

                  Thanks a lot...
                  Fateh