1 Reply Latest reply on May 14, 2015 1:00 PM by PaulGall123

    Error With Post Request From Example In Documentation

    PaulGall123

      Hello,

       

      I am currently going through the example that is within the documentation about uploading images with ORDS and I am facing an issue with the post resource handler. Below is my code.

       

      declare
      image_id integer;
      begin
      insert into gallery (title,content_type,image)
                   values  (:title,:content_type,:body)
                   returning id into image_id;
      :status := 201;
      :location := image_id;
      end;  
      
      

       

      And below is the parameters I have set up for it:

       

      NameBind Variable NameAccess MethodSource TypeParameter Type
      X-APEX-FORWARDlocationOUTHTTP HeaderString
      X-APEX-STATUS-CODEstatusOUTHTTP HeaderInteger
      slugtitleINHTTP HeaderString

       

      I have tried testing it and I keep getting a 500 Internal Server Error. I have put on logging for this to see exactly what is happening and the error is:

       

      Request Path passes syntax validation
      Mapping request to database pool: PoolMap [_failed=false, _lastUpdate=1380063600000, _pattern=/apex_live/, _poolName=apex, _regex=null, _type=BASE_PATH, _workspaceIdentifier=APEX_LIVE, _serviceName=null]
      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
      gallery/images/ matches: gallery/images/ score: 0
      Choosing: oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplateDispatcher as current candidate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=1318300956210328|5864607643166967, uriTemplate=gallery/images/], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logonConfig=NONE], 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 candidate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=1318300956210328|5864607643166967, uriTemplate=gallery/images/], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logonConfig=NONE], originsAllowed=[], corsEnabled=true] for: POST gallery/images/
      gallery/images/ is a public resource
      Using generator: oracle.dbtools.rt.plsql.AnonymousBlockGenerator
      Performing JDBC request as: FM_APEX
      Error during evaluation of resource template: ORA-06550: line 1, column 9:
      PLS-00103: Encountered the symbol "" when expecting one of the following:
      
        begin function package pragma procedure subtype type use
        <an identifier> <a double-quoted delimited-identifier> form
        current cursor
      
      
      
      
      WebException [statusCode=500, reasons=[Error during evaluation of resource template: POST gallery/images/, SQL Error Code: 6,550, SQL Error Message: ORA-06550: line 1, column 9:
      PLS-00103: Encountered the symbol "" when expecting one of the following:
      
         begin function package pragma procedure subtype type use
         <an identifier> <a double-quoted delimited-identifier> form
         current cursor
      ]]
           at oracle.dbtools.rt.web.WebException.webException(WebException.java:343)
           at oracle.dbtools.rt.web.WebException.internalError(WebException.java:262)
           at oracle.dbtools.rt.resource.templates.v2.ResourceTemplatesDispatcher.checkForTemplateEvaluationError(ResourceTemplatesDispatcher.java:211)
           at oracle.dbtools.rt.resource.templates.v2.ResourceTemplatesDispatcher.access$300(ResourceTemplatesDispatcher.java:49)
           at oracle.dbtools.rt.resource.templates.v2.ResourceTemplatesDispatcher$HttpResourceGenerator.response(ResourceTemplatesDispatcher.java:313)
           at oracle.dbtools.rt.web.RequestDispatchers.dispatch(RequestDispatchers.java:97)
           at oracle.dbtools.rt.web.ETags.checkPrecondition(ETags.java:93)
           at oracle.dbtools.rt.web.HttpEndpointBase.restfulServices(HttpEndpointBase.java:426)
           at oracle.dbtools.rt.web.HttpEndpointBase.service(HttpEndpointBase.java:164)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
           at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
           at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
           at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
           at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
           at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
           at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
           at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
           at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
           at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
           at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
           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)
      Caused by: JDBCException [kind=SQL]
           at oracle.dbtools.common.jdbc.JDBCException.wrap(JDBCException.java:88)
           at oracle.dbtools.rt.plsql.AnonymousBlockGenerator.generate(AnonymousBlockGenerator.java:223)
           at oracle.dbtools.rt.resource.templates.v2.ResourceTemplatesDispatcher$HttpResourceGenerator.response(ResourceTemplatesDispatcher.java:311)
           ... 29 more
      Caused by: java.sql.SQLException: ORA-06550: line 1, column 9:
      PLS-00103: Encountered the symbol "" when expecting one of the following:
      
         begin function package pragma procedure subtype type use
         <an identifier> <a double-quoted delimited-identifier> form
         current cursor
      
           at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
           at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
           at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
           at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:505)
           at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:223)
           at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
           at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:205)
           at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1043)
           at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336)
           at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3612)
           at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3713)
           at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4755)
           at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1378)
           at sun.reflect.GeneratedMethodAccessor283.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at oracle.ucp.jdbc.proxy.StatementProxyFactory.invoke(StatementProxyFactory.java:230)
           at oracle.ucp.jdbc.proxy.PreparedStatementProxyFactory.invoke(PreparedStatementProxyFactory.java:124)
           at oracle.ucp.jdbc.proxy.CallableStatementProxyFactory.invoke(CallableStatementProxyFactory.java:101)
           at $Proxy281.execute(Unknown Source)
           at oracle.dbtools.common.jdbc.JDBCCallImpl.execute(JDBCCallImpl.java:44)
           at oracle.dbtools.rt.plsql.AnonymousBlockGenerator.generate(AnonymousBlockGenerator.java:184)
           ... 30 more
      

       

      Our systems are:

       

      Database: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit

      Apex Version: 4.2.2.00.11

      Oracle ORDS: 2.0.10

       

      Any help on this would be greatly appreciated.

       

      Cheers,

      Paul.