RESTful Service: Expose BLOB file inside DB as RESTful service ??

Hello,
With Oracle Cloud we can expose the Data as RESTful Web Service, but how about exposing BLOB... we need to generate a link for that file which is stored in the DB.
To make it clearer:
Two Tables:
Properties (Property_ID number PK, Project varchar2(40), Property_number varchar2(20) ...)
Images  (ID number PK, Property_ID number FK, content blob,
mimetype varchar2(200), filename varchar2 (200), filesize varchar2 (200))And I would like to expose this query as RESTful :
Select p.property_id, p.project, p.property_number, i.content
from properties p inner join images i on (p.property_id = i.property_id)Usually we use: [url http://docs.oracle.com/cd/E14373_01/apirefs.32/e13369/apex_util.htm#CHDICGDA] apex_util.get_blob_file_src  , but that one should be called from a valid apex session !!!!! ( in that query "i.content" should give a link.)
How can we do it ???
Another point, since we expose the data as JSON:
Suppose I have a property with 10 images, then it does not make sense to get 10 rows fro the same property just to give different image. I think we need another level (nested level) for images !!!
I hope that my point is clear,
Thanks in advance ....
Fateh

Hi Fateh -
Good question. You would identify the source type as a Media Resource, and use an SQL statement with the primary key and the BLOB column. When you use Media Resource, you are essentially telling your Database Cloud Service not to marshall the data, just to send it - which is exactly what you are looking for.
With this implementation, you would have to have a separate SQL call for each BLOB retrieval. However, you might be able to use a PL/SQL block as the end point for the RESTful Service and take care of multiple BLOB processing in the block.
Hope this helps.
- Rick Greenwald

Similar Messages

  • Do SMP3.0 supports JSON based RESTful services exposed via JBOSS server??

    Hi All,
    We are working on a PoC for a customer to consume JSON based RESTful (exposed via JBOSS Server) service from SMP 3.0. We were not able to get the DataSet. the below are the steps which we performed and the respective result.
    1) Created a SMP Application - Able to ping the application with the base URL
    2) Tested the connections - Able to create a Registration using Firefox POSTMAN client
    3) Data Consumption from the service - We are not able to get the response for the service when we try the same via SMP,but we are able to get the data when we try the REST service URL directly from the browser.
    How do we achieve this? Do SMP3.0 support JSON based RESTful service? Can Integration Gateway Help?
    Thanks, Prem

    hi Jitendra,
    attached are the screen shots of both SMP service from postman we tried and the original service from the browser.
    1- postman ping for SMP URL and header says success.
    2- Response body with entity set structure and empty data there is no data inside the collection named "Connection" as well and if i call this i fails with 501, that not implemented, so i guess SMP3 is unable to create the entity set out the JSON REST services while converting it into Odata service internally.
    3- i can view data if run directly the REST service from browser.

  • Exposing BLOB's to Oracle Files

    Is it possible to 'expose' BLOB's from a user table external to Oracle Files. I can't find anything in the docu. but I think that this is such an important issue in integrating legacy applications that it should be possible. At least there should be a PL/SQL API.
    Any comments or suggestions would be appreciated.

    Check this untested from my side..
    CREATE OR REPLACE PROCEDURE extract_file (pid IN NUMBER) IS
       vblob      BLOB;
       vstart     NUMBER;
       bytelen    NUMBER := 32000;
       len        NUMBER;
       my_vr      RAW (32000);
       x          NUMBER;
       l_output   UTL_FILE.file_type;
    BEGIN
       -- define output directory
       l_output :=
          UTL_FILE.fopen ('dir_chandra',
                          'aa',
                          'wb',
                          32760);
       vstart := 1;
       bytelen := 32000;
       -- get length of blob
       SELECT DBMS_LOB.getlength (LAST_UPDATE_DATA)
         INTO len
         FROM srch_project
        WHERE id = pid;
       -- save blob length
       x := len;
       -- select blob into variable
       SELECT LAST_UPDATE_DATA
         INTO vblob
         FROM srch_project
        WHERE id = pid;
       -- if small enough for a single write
       IF len < 32760 THEN
          UTL_FILE.put_raw (l_output, vblob);
          UTL_FILE.fflush (l_output);
       ELSE                                                     -- write in pieces
          vstart := 1;
          WHILE vstart < len AND bytelen > 0 LOOP
             DBMS_LOB.read (vblob,
                            bytelen,
                            vstart,
                            my_vr);
             UTL_FILE.put_raw (l_output, my_vr);
             UTL_FILE.fflush (l_output);
             -- set the start position for the next cut
             vstart := vstart + bytelen;
             -- set the end position if less than 32000 bytes
             x := x - bytelen;
             IF x < 32000 THEN
                bytelen := x;
             END IF;
          END LOOP;
          UTL_FILE.fclose (l_output);
       END IF;
    END extract_file;Cheers,
    Manik.

  • Open BLOB files

    Hi,
    I’m having some problem with access BLOB files:
    I have a VO that is based on some tables including fnd_lobs.
    I want to let the user access the field - file_data.
    When I use the item type messageDownLoad – I get error after opening the file: “can’t determine type”
    although the attribute Mime Type has the correct data type.
    (I’ve created the item using the guidelines in the Oracle Applications Framework Developer's Guide)
    But if I use the function: fnd_gfm.construct_download_url to get the file’s url, I can access the file without any problem:
    pageContext.setRedirectURL(fileUrl,false);
    I wanted to know:
    * Are there any specific declarations for using messageDownLoad that is a field in a table?
    * Is there a parameter that I can use while calling the function pageContext.setRedirectURL – so the URL will be opened in a different window?
    Thanks!
    Rona.

    Hello,
    By the way, now it starts magically working. Am really disappointed that there is no way for me to raise support ticket for such issues.
    For sure something has changed on the Azure service, but its just a bit sad that I have to pay in case I wish to report such issues. :(
    For your benefit details are here..
    VS 2010, Open Server Explorer and then open your Azure account, under that open Blob and then it did not respond. ( today it does, and I can see my folders and files inside them)
    Regarding "you can open it in your Azure portal", I am not sure of your question. But I have been able to open the manage.WindowsAzure.com and look at my storage account details on the day had problems.
    Thanks.
    Manu

  • Need to take SQL Azure database backup into blob using dacpac services, the blob has to be encrypted.

    We are able to take backup of our database into blob storage using dacpac services, but we need to encrypt the blob data. Please suggest the efficient way to do it.

    Hello,
    As per my understanding, Windows Azure Storage does not transparently encrypt data or provide any special encryption mechanisms. Azure Blob Storage protect the data by using a storage key to control access to all data in that Storage Account.
    If you want to encrypt data of file inside Azure Blob Storage Services , you can refer to the following thread about same requirement:
    http://social.msdn.microsoft.com/Forums/windowsazure/en-US/23465a1e-1fce-481a-b375-6e2434186ea6/encrypt-sql-azure-blob-data?forum=windowsazuredata#bf6c9921-176e-4c76-b976-3b94c795cd16
    Regards,
    Fanny Liu
    If you have any feedback on our support, please click here. 
    Fanny Liu
    TechNet Community Support

  • How to open a .par file inside NWDS

    hi all,
    please help me out I want to open a .par file inside NWDS and make change the theame.
    thanks & regards

    Hi Jitender,
    Please try and do the customisation of teh Login page using this Document:
    <b><a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/ep/_a-c/customizing%20the%20logon%20user%20interface%20of%20sap%20enterprise%20portal%206.0">Customise the Login Page</a></b>
    Also try the how-to guide:
    <b>http://service.sap.com/epinstall -> SAP Enterprise Portal 6.0 -> Documentation and More -> How-To Guides -> How to Customize the Logon Screen</b>
    I hope this helps you..
    Regards
    Pravesh

  • How integrate azure media services with blob storage?

    I need to upload lots of content over blob storage which contains different types of files.
    Now my problem is that files contains lots of videos also.
    I want to way by which i can integrate azure media services with blob storage so that i can stream that video.
    So probably i don't want to upload my videos on azure media services storage because i want all my content to be at one place which is blob storage.
    Is there any way to achieve this?
    Thanks,
    Rajesh Khunt
    Blog : http://programmersgeek.wordpress.com/
    Twitter : http://twitter.com/#!/r_rajeshkhunt
    Linkedin : http://in.linkedin.com/in/rajeshkhunt

    Hi Rajesh
    Every Media Services account needs a blob storage account associated with it. You can choose an existing blob storage account for that purpose. In order for Media Services to work with your videos you need to create an asset using the Media Services APIs.
    That call results in the creation of a container which has the name in the following format asset-<AssetId>. The actual video files need to go as blobs within this container but these files need to be known to Media Services and you can do so by adding
    AssetFiles to the asset using the Media Services APIs. Once you do that the asset is well known to Media Services and you can stream it.

  • Can I place jar files inside ejb-jar.jar?

    Hi,
    I'm reading about the packaging rules for creating an ejb-jar.jar file, and I'm wondering whether it's possible to include a jar file (containing helper classes) inside of the ejb-jar file. A "lib" dir (for containing such helper jars) doesn't seem to be part of the ejb-jar file format.
    The EJB 3 spec has this to say (Ch 20, "Enterprise JavaBeans 3.0, Final Release):
    "The ejb-jar file must also contain, either by inclusion or by reference, the class files for all the classes and interfaces that each enterprise bean class and the home interfaces, component interfaces, and/or web service endpoints depend on, except Java EE and J2SE classes. This includes their superclasses and superinterfaces, dependent classes, and the classes and interfaces used as method parameters, results, and exceptions"
    Now, it seems that the root of the the ejb-jar file contains all the classes (in the appropriate Java package layout). But what about including JAR files? The ejb-jar spec seems to have nothing to say about a "lib" dir that can contain jars (as a WAR file can).
    Summary of questions:
    1) Can an ejb-jar file contain a jar file? If so, how/where?
    2) Can the ejb-jar file's META-INF/MANIFEST.MF file contain a reference to a JAR file?
    I'm not considering correct design at the point... I'd just like to know if these 2 scenarios are possible.
    Thank you!
    kamuifx

    Yes, I have an ear file..................
    I have an EAR file; inside the EAR I have a WAR file (web module) and an EJB-jar file (EJB module).......... the EJB need some classes placed in a jar file (a helper .jar or an util .jar)...........
    my question is: How can I use the classes of the .jar files in te EJB??????
    thanks

  • How to read a blob file using dbadapter

    how to read or select a blob file in a table using dbadapter

         public void fileRead(){
                 File aFile =new File("myFile.txt");
             BufferedReader input = null;
             try {
               input = new BufferedReader( new FileReader(aFile) );
               String line = null;
               while (( line = input.readLine()) != null){
             catch (FileNotFoundException ex) {
               ex.printStackTrace();
             catch (IOException ex){
               ex.printStackTrace();
         }This code is to read a text file. But there is no such thing that will convert your text file to xml file. You have to have a defined XML format. Then you can read your data from text files and insert them inside your xml text. Or you may like to read xml tags from text files and insert your own data. The file format of .txt and .xml is far too different.
    cheers
    Mohammed Jubaer Arif.

  • Confused about "files inside a JAR"

    I have a program that has a Properties file which I would like to "save" into the JAR file, so it is not outside the JAR.
    I know this can be done, because I've seen some Java programs that save their configuration between sessions, but not via a file inside its directory. This leads me to believe the file is maintained within the JAR itself, which would be REALLY handy and secure.
    Is this a correct assumption? If so, how would I do it? Here's a "test program" that we can play with, how would I save MyProperties' properties field into the MyProgram JAR?
    package SBX;
    import java.util.*;
    import java.io.*;
    public class MyProgram {
        // Instance Variables
        public MyProperties myProp = new MyProperties();
        public String stringOne = "Will this be loaded?";
        public String stringTwo = "How about this one?";
        // Main Method
        public static void main(String[] args) {
            new MyProgram();
        // Constructors
        public MyProgram() {
            if ((new File("properties.txt")).exists()) {
                myProp.updateProgram(this);
            System.out.println("1) " + stringOne);
            System.out.println("2) " + stringTwo);
            myProp.updateProgram(this);
            System.out.println("3) " + stringOne);
            System.out.println("4) " + stringTwo);
            myProp.updateProperties(this);
            // Now that we've "updated" stringOne & stringTwo and "updated" myProp and saved it,
            // we should be able to get the values "ONE" and "TWO" for print outs 1 & 2 when we next
            // run the program, instead of "Will this be loaded?" and "How about this one?", as we got during the first run.
            // However, the thing I need help with is saving the Properties to the JAR file so it's not accessable
            // outside of the JAR file. How can this be done?
    class MyProperties {
        // Instance Variables
        private Properties properties;
        // Constructors
        public MyProperties() {
            Properties defaults = new Properties();
            defaults.setProperty("stringOne", "ONE");
            defaults.setProperty("stringTwo", "TWO");
            properties = new Properties(defaults);
            try {
                FileInputStream fis = new FileInputStream("properties.txt");
                properties.load(fis);
                fis.close();
            catch (Exception e) {
                System.out.println("No properties file found, ignore this; one will be saved when the program exits.");
        // Methods
        public void updateProgram(MyProgram prg) {
            prg.stringOne = properties.getProperty("stringOne");
            prg.stringTwo = properties.getProperty("stringTwo");
        public void updateProperties(MyProgram prg) {
            properties.setProperty("stringOne", prg.stringOne);
            properties.setProperty("stringTwo", prg.stringTwo);
            try {
                FileOutputStream fos = new FileOutputStream("properties.txt");
                properties.store(fos, "A header");
                fos.close();
            catch (Exception e) {
                e.printStackTrace();
    }Thanks for any help!
    PS...writing demo programs is kind of fun :)

    Fossie,
    Yup... you can jar up your properties file... you just need to add it to manifest file and jar (the program) takes care of the rest... google that there's loads of existing articles.
    BUT, I don't think you can modify the properties file in the jar... it may be possible, but I just don't know how. Instead (I think) you ship your default properties file in the jar, but still save a local properties file to the same directory as the jar (obviously won't work for applets)... then you load your defaults, and the local settings over the top.
    and PS I don't see how sticking a properties file in the jar would "secure" it in any fashion... it's just a zip file after all... would you care to elaborate?
    Cheers,
    Keith.

  • Examples needed for Idoc to file and IDOC to web services

    Hi ,
    Could any one of you give some examples which take me through step-by-step in building IDOC-TO-FILE and IDOC-TO-WEB SERVICES?
    Regards,
    XI Developer.

    Hi,
    For IDOC scenario you need to first do the required configuration:
    ALE configuration for pushing idocs from SAP to XI
    /people/swaroopa.vishwanath/blog/2007/01/22/ale-configuration-for-pushing-idocs-from-sap-to-xi
    Testing purpose u can use the below method:
    IDOC testing using WE19
    /people/sameer.shadab/blog/2005/07/25/reposting-idocs-instead-of-recreating--for-testing-purpose-xi
    /people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters --> For Idoc sender: IDOC -file
    IDOC configuration:
    Please follow the below process for configuration:
    Pre-requisites for Inbound IDoc to R/3 from PI:
    Configuration required at Xi side:
    Go to IDX1: configure the port.
    Go to IDX2: load the DOC metadata.
    Go to SM59: Create RFC destination which points to R3 system this is require in the case where your IDOC is sent to R 3 system,
    Configiration required at R3 side:
    Maintain Logical System for PI (SALE transaction):
    Maintain Partner Profile for XI system(WE20):
    Pre-requisites for Outbound IDoc from R/3 to PI:
    Configurations required in R/3:
    Maintain Logical System (SALE)
    Define RFC Destination (SM59) which points to PI system
    Maintain Port (WE21)
    Maintain partner profile. (WE20):
    Maintain Distribution Model (BD64):
    File To IDOC - Part1 (SLD and Design):
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/2007/05/11/fileToIDOC&
    File To IDOC - Part2 (Configuration):
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/2007/05/11/fileToIDOC-Part2+(Configuration)&
    File To IDOC - Part3 (Steps required in XI and R3):
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/2007/05/11/fileToIDOC-Part3(StepsrequiredinXIandR3)&
    SOAP scenario:
    YOu have to first create the WSDL through ID and import that WSDL in to IR external definition.
    Refer the below thread and pdf:
    How to use SOAP adapter:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40611dd6-e66e-2910-f383-e80fb44f9cd4
    SAP AII - How to consume and expose webservices  ?
    Thnx
    Chirag
    reward points if it helps.

  • Orphaned Blob Files

    We run a gwcheck post office and library maintenance / fix process once a week.
    we see a large number of the following error message for a single user, different file name for each instance
    Error 50- Orphaned Blob file: 46ADBF20.000
    I suspect the 'documents' no longer exist on the network but the reference is still there in the library.
    How do I cleanup these orphans?

    dkerbaugh,
    It appears that in the past few days you have not received a response to your
    posting. That concerns us, and has triggered this automated reply.
    Has your problem been resolved? If not, you might try one of the following options:
    - Visit http://support.novell.com and search the knowledgebase and/or check all
    the other self support options and support programs available.
    - You could also try posting your message again. Make sure it is posted in the
    correct newsgroup. (http://forums.novell.com)
    Be sure to read the forum FAQ about what to expect in the way of responses:
    http://forums.novell.com/faq.php
    If this is a reply to a duplicate posting, please ignore and accept our apologies
    and rest assured we will issue a stern reprimand to our posting bot.
    Good luck!
    Your Novell Product Support Forums Team
    http://forums.novell.com/

  • Download_my_file open file inside browser without dialog

    how do i amend the download_my_file procedure so that it will open a pdf, word etc file inside the browser automatically. i want it to behave just as any site does when i click a pdf, it doesnt ask me to save or open it, it just opens it inside my browser.
    here is my code
    -- set up HTTP header
    owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE );
    -- set the size so the browser knows how much to download
    htp.p('Content-length: ' || v_length);
    -- the filename will be used by the browser if the users does a save as
    htp.p('Content-Disposition: attachment; filename="' || v_file_name || '"');
    -- close the headers
    owa_util.http_header_close;
    -- download the BLOB
    wpg_docload.download_file( Lob_loc );
    anybodys help would be greatly appreciated

    PROCEDURE SHOW_LOB (
                p_id          IN XE_LOBS.ID%TYPE
              , p_show_inline IN PLS_INTEGER DEFAULT 0
      IS
        l_mime_type    XE_LOBS.MIME_TYPE%TYPE ;
        l_file_name    XE_LOBS.FILE_NAME%TYPE;
        l_display_name XE_LOBS.DISPLAY_NAME%TYPE;
        l_lob_size     XE_LOBS.LOB_SIZE%TYPE;
        l_lob_value    BLOB;
        l_user_id      HTMLDB_USERS.USERNAME%TYPE DEFAULT -1;
        l_illegal_msg  Tool.long_msg_t%TYPE;
      BEGIN
        BEGIN
          SELECT mime_type  , file_name  , display_name  , lob_size  , lob_value
            INTO l_mime_type, l_file_name, l_display_name, l_lob_size, l_lob_value
            FROM XE_LOBS
           WHERE ID = p_id;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN
            Pkg_Pragma_Core.auto_log_error('fnc "SHOW_LOB"!');
            RAISE Tool.MY_FORCED_EXCEPTION;
          WHEN OTHERS THEN
            Pkg_Pragma_Core.auto_log_error('fnc "SHOW_LOB"-2. when others)!');
            RAISE Tool.MY_FORCED_EXCEPTION;
        END;
        -- Set Up Http Header
        -- Use An Nvl Around The Mime Type And  If It Is A Null, Set It To
        -- Application/octect - Which May Launch A Download Window From Windows
        Owa_Util.MIME_HEADER(NVL(l_mime_type,'application/octet'), FALSE );
        -- Set The Size So The Browser Knows How Much To Download
        Htp.P('Content-length: ' || l_lob_size);
        IF p_show_inline=1 THEN
          Htp.P('Content-Disposition:  filename="'||l_file_name||'"');
        ELSE
             -- the filename will be used by the browser if the users does a save as ... extension work
          Htp.P('Content-Disposition:  attachment; filename="'||l_file_name||'"');
        END IF;
        -- Close The Headers
        Owa_Util.Http_Header_Close;
        -- Download The Blob
        Wpg_Docload.Download_File( l_lob_value );
      EXCEPTION
        WHEN Tool.MY_FORCED_EXCEPTION THEN
          htp.P(Tool.XE_LANG_MESSAGE(Tool.others_error_msg_user,Tool.others_error_msg_user_en)||' Back');
        WHEN OTHERS THEN
          Pkg_Pragma_Core.auto_log_error('fnc "SHOW_LOB"-when others error (glavni)!');
          htp.P(Tool.XE_LANG_MESSAGE(Tool.others_error_msg_user,Tool.others_error_msg_user_en)||' Back');
      END SHOW_LOB;If "p_show_inline" is 0 then save as dialog is shown, else if p_show_inline=1 then inline presentation of lob (in browser-that is what you want!)
    XE_LOBS is table where lobs are saved:
    XE> desc xe_lobs
    Name                                                  Null?    Type
    ID                                                    NOT NULL NUMBER(38)
    STATUS                                                NOT NULL NUMBER(38)
    MIME_TYPE                                                      VARCHAR2(128 CHAR)
    FILE_NAME                                                      VARCHAR2(255 CHAR)
    LOB_VALUE                                                      BLOB
    LOB_SIZE                                                       NUMBER(38)

  • Expose a Human Task as a web service, is posible ?

    Hi everyone, is there a way to expose a human task as a web service using BPM Studio or other way ?

    Hi Carlos
    Human Task by itself do not have any significance or play any role. Its the Process or Sub Process where that Human Task is used is what is important. And you can Expose any BPM Process as a WebService. Infact by default it is already a WebService if you observer closely. We can generate a WebService client for any BPM Process.
    So I am not clear on what exactly you are asking by exposing a Human Task as Web Service which I guess is NOT possible. This Human Task .TASK file do not have anything except for its definition.
    Thanks
    Ravi Jegga

  • Automator service to open file in app only works if app is closed

    For my work I frequently need to edit text files that have non-standard extensions (and many have no extension at all). So for convenience when browsing in Finder, I created a simple Automator service that opens selected files TextMate:
    It works but the problem is that it only works if TM is initially closed before running the service. If it's open when the service runs, the TM menu bar appears but the file doesn't open. If I close TM and re-run the service, the file opens. How should I modify the service so that it will work whether or not TM is initially open or closed? Thanks!

    Thanks! That works, but I had to keep the 'Get Selected Finder Items' as the first action.
    Both of these configurations open an empty TextMate window:

Maybe you are looking for