1 Reply Latest reply: Mar 27, 2013 12:22 PM by Zack.L RSS

    Restful service unable to insert data using PL/SQL.

    Zack.L
      Hi all,
      Am running:
      AL 2.01 standalone mode on OEL 4.8 in VM box A.
      Oracle database 10.2.0.4 with Apex 4.2.0.00.27 on OEL4.8 in VM box B.

      Able to performed oracle.example.hr Restful services with no problem.

      Using the below example:
         Workspace : wsdemo
       RESTful Service Module:  demo/
                URI Template:      test
                      Method:  POST
                 Source Type:  PL/SQL
      Source
      begin
       insert into scott.json_demo values(:title,:description);
      end;
      which uses the following table (under schema: scott):
      create table json_demo ( title varchar2(20), description varchar2(1000) );
      grant all on json_demo to apex_public_user;
      Errors encountered when set bind variable and Test:

      ==== Request Processed ====
      Processed PL/SQL Gateway request
      Request Path passes syntax validation
      Mapping request to database pool: PoolMap [_poolName=apex, _regex=null, _workspaceIdentifier=WSDEM                          O, _failed=false, _lastUpdate=1364313600000, _template=/wsdemo/, _type=BASE_PATH]
      Applied database connection info
      Attempting to process with PL/SQL Gateway
      Not processed as PL/SQL Gateway request
      Attempting to process as a RESTful Service
      demo/test matches: demo/test score: 0
      Choosing: oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplateDispatcher as current cand idate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=2648625079503782|2797815                          111031405, uriTemplate=demo/test], score=0, scope=SecurityConfig [constraint=none, realm=NONE, log                          onConfig=LogonConfig [logonForm=null, logonFailed=null]], originsAllowed=[], corsEnabled=true]
      Determining if request can be dispatched as a Tenanted RESTful Service
      Request path has one path segment, continuing processing
      Tenant Principal already established, cannot dispatch
      Chose oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplateDispatcher as the final candid ate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=2648625079503782|279781511                          1031405, uriTemplate=demo/test], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logon                          Config=LogonConfig [logonForm=null, logonFailed=null]], originsAllowed=[], corsEnabled=true] for: GET demo/test
      demo/test is a public resource
      WebException [statusCode=405, allowableMethods=[POST]]
           at oracle.dbtools.rt.web.WebException.webException(WebException.java:326)
           at oracle.dbtools.rt.web.WebException.methodNotAllowed(WebException.java:262)
           at oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplates.allowableMethods(JDBCResourceTemplates.java:207)
           at oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplates.resourceHandler(JDBCResourceTemplates.java:91)
           at oracle.dbtools.rt.resource.templates.v2.ResourceTemplatesDispatcher.dispatch(ResourceTemplatesDispatcher.java:90)
           at oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplateDispatcher.dispatch(JDBCResourceTemplateDispatcher.java:90)
           at oracle.dbtools.rt.web.RequestDispatchers.dispatch(RequestDispatchers.java:84)
           at oracle.dbtools.rt.web.HttpEndpointBase.restfulServices(HttpEndpointBase.java:412)
           at oracle.dbtools.rt.web.HttpEndpointBase.service(HttpEndpointBase.java:162)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
           at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.doFilter(ServletAdapter.java:1059)
           at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.invokeFilterChain(ServletAdapter.java:999)
           at com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:434)
           at oracle.dbtools.standalone.SecureServletAdapter.doService(SecureServletAdapter.java:65)
           at com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:379)
           at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
           at com.sun.grizzly.tcp.http11.GrizzlyAdapterChain.service(GrizzlyAdapterChain.java:196)
           at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
           at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
           at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
           at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
           at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
           at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
           at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
           at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
           at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
           at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
           at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
           at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
           at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
           at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
           at java.lang.Thread.run(Thread.java:662)
      Thanks in advance
      Regards
      Zack
        • 1. Re: Restful service unable to insert data using PL/SQL.
          Zack.L
          Ok, just read from the below that TEST button is only for GET request.
          Oracle® Application Express Listener
          Release Notes
          Release 2.0
          E25068-03
          February 2013
          
          Oracle Application Express RESTful Service Test Button
          The Oracle Application Express RESTful Services UI includes a Test button that may
          be used to test RESTful Services. In Oracle Application Express release 4.2, this button
          is enabled for all kinds of Resource Handlers, but note that it is only actually able to
          test GET Resource Handlers.
          Regards
          Zack