2 Replies Latest reply: Nov 21, 2011 9:54 AM by user503699 RSS

    REST web service using PL/SQL


      I am trying to learn how a REST web service can be created using PL/SQL and how it can be used.
      I am using this as a starting point.
      Also, I am using the pre-build "Oracle Developer Days" setup for this (which means I have 11.2 version of oracle database installed).
      I have done all the steps mentioned in the above blog post but when I try to access the web service in browser, I get the
      "404 Not found - The requested URL /devtest/rest-demo/departments was not found on this server" message.
      Here is my DAD setup :
      SQL> declare
        l_name dbms_epg.varchar2_table;
        l_value dbms_epg.varchar2_table;
        DBMS_EPG.GET_ALL_DAD_ATTRIBUTES (dad_name => 'devtest', attr_names => l_name, attr_values => l_value);
        for i in l_name.first..l_name.last
          dbms_output.put_line(l_name(i)||' => '||l_value(i));
        end loop;
        2    3    4    5    6    7    8    9   10   11  database-username => HR1
      path-alias => rest-demo
      path-alias-procedure => rest_handler.handle_request
      I have created the package and procedures as mentioned in that blog post
      SQL> desc hr1.rest_handler
       Argument Name                  Type                    In/Out Default?
       ------------------------------ ----------------------- ------ --------
       P_PATH                         VARCHAR2                IN
      Have I missed something ?
      Any help will be appreciated.
        • 1. Re: REST web service using PL/SQL
          Marco Gralike
          Probably an security issue, I guess. The article (http://ora-00001.blogspot.com/2009/07/creating-rest-web-service-with-plsql.html) mentioned is a very good one (if not only I like what the site has become in recent years - much good tips and articles). As an alternative for your problems, have a look at the explaination of how Tim Hall has done it...


          Edited by: Marco Gralike on Nov 21, 2011 11:31 AM
          • 2. Re: REST web service using PL/SQL

            Thanks for your suggestions.
            I have managed to resolve the issue. It was with the way I had created DAD. I had not mentioned any value for the optional "path" parameter while creating the DAD.
            When I recreated the DAD by providing "/devtest/*" as the value for path, everything worked fine.