POST - RESTful Service to insert a row

Hello,
How can We utilize Post method in APEX RESTful ?
I would like to insert a row (contact details) into the database from a form on a STATIC / Standalone HTML page.
I found this example, but I have no idea how to accomplish my objective ?
http://s15.postimg.org/65w6i858r/Screen_Shot_2014_04_02_at_7_13_38_AM.png
Regards,

Hi Faraz,
You have several options:
In any APEX application, go to Shared Components / Web Service References. Here you can define a reference to a RESTful web service from the same Cloud service and specify POST or PUT method (among others).
Some browsers have plug-ins that implement REST web service clients (for example, "Advanced REST client" for Chrome).
You can also use command line tools like wget and curl.
Vlad

Similar Messages

  • APEX post restful service inserts null value

    Oracle APEX 4.2.5
    Oracle Rest Data Service 2.0.7
    Apache Tomcat 7
    Oracle database 11.2.0.4
    Oracle APEX PUT web service inserts null value into column. This is either a bug or the documentation does not properly cover how to correctly set PUT restful services. 
    GET web services works fine. 
    I have granted the role of apex_rest_public_user to both apex_public_user and the schema owner. 
    The payload is a small xml document, but even a text document will yield the same result. 
    I am using the Oracle REST Data Service 2.0.5
    Web service code: 
    RESTful Service Module: software_details/
    URI Template: xml_parser
    Method: POST
    Source Type: PL/SQL
    MIME: Types Allowed: application/xml
    Requires Secure Access: NO
    Source :
    begin
    insert into clob_test (x)
    values (blob_to_clob(:body)); ## according to some online post,  :body is where APEX places any data being transferred through a web service. I have yet to find any official  ##documentation on it. 
    commit:
    end;
    ##Blob_to_clob function code
    CREATE OR REPLACE FUNCTION blob_to_clob (blob_in IN BLOB)
    RETURN CLOB
    AS
          v_clob    CLOB;
          v_varchar VARCHAR2(32767);
          v_start      PLS_INTEGER := 1;
          v_buffer  PLS_INTEGER := 32767;
    BEGIN
          DBMS_LOB.CREATETEMPORARY(v_clob, TRUE);
          FOR i IN 1..CEIL(DBMS_LOB.GETLENGTH(blob_in) / v_buffer)
          LOOP
             v_varchar := UTL_RAW.CAST_TO_VARCHAR2(DBMS_LOB.SUBSTR(blob_in, v_buffer, v_start));
                DBMS_LOB.WRITEAPPEND(v_clob, LENGTH(v_varchar), v_varchar);
               v_start := v_start + v_buffer;
          END LOOP;
        RETURN v_clob;
    END blob_to_clob;
    #Table code 
    create table clob_test(
    x clob));
    Thank you,

    I am experiencing the same issue.
    I implemented the 'chunked file loading' example from Kris Rice's blog at Kris' blog: August 2013 in y workspace at the Oracle hosted APEX site and everything works fine.
    However, I get a null value for 'data' when I implement the same example at my work site.
    Work Site config is
    Apache Tomcat 7
    Oracle REST Data Services version : 2.0.6.27.18.06
    Application Express 4.2.2.00.11
    Oracle RDBMS 11.2.0.3
    I am NOT using SSL at my work site. However this does not seem to affect a POST with form values.
    Varad.

  • Restful service unable to insert data using PL/SQL.

    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.
    Unable to insert data using AL 2.0.1 but works on AL 1.1.4.
    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; and below procedure ( scott's schema ):
    CREATE OR REPLACE
    PROCEDURE post(
        p_url     IN VARCHAR2,
        p_message IN VARCHAR2,
        p_response OUT VARCHAR2)
    IS
      l_end_loop BOOLEAN := false;
      l_http_req utl_http.req;
      l_http_resp utl_http.resp;
      l_buffer CLOB;
      l_data       VARCHAR2(20000); 
      C_USER_AGENT CONSTANT VARCHAR2(4000) := 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)';
    BEGIN
      -- source: http://awads.net/wp/2005/11/30/http-post-from-inside-oracle/
      -- Ask UTL_HTTP not to raise an exception for 4xx and 5xx status codes,
      -- rather than just returning the text of the error page.
      utl_http.set_response_error_check(false);
      -- Begin the post request
      l_http_req := utl_http.begin_request (p_url, 'POST', utl_http.HTTP_VERSION_1_1);
      -- Set the HTTP request headers
      utl_http.set_header(l_http_req, 'User-Agent', C_USER_AGENT);
      utl_http.set_header(l_http_req, 'content-type', 'application/json;charset=UTF-8');
      utl_http.set_header(l_http_req, 'content-length', LENGTH(p_message));
      -- Write the data to the body of the HTTP request
      utl_http.write_text(l_http_req, p_message);
      -- Process the request and get the response.
      l_http_resp := utl_http.get_response (l_http_req);
      dbms_output.put_line ('status code: ' || l_http_resp.status_code);
      dbms_output.put_line ('reason phrase: ' || l_http_resp.reason_phrase);
      LOOP
        EXIT
      WHEN l_end_loop;
        BEGIN
          utl_http.read_line(l_http_resp, l_buffer, true);
          IF(l_buffer IS NOT NULL AND (LENGTH(l_buffer)>0)) THEN
            l_data    := l_data||l_buffer;
          END IF;
        EXCEPTION
        WHEN utl_http.end_of_body THEN
          l_end_loop := true;
        END;
      END LOOP;
      dbms_output.put_line(l_data);
      p_response:= l_data;
      -- Look for client-side error and report it.
      IF (l_http_resp.status_code >= 400) AND (l_http_resp.status_code <= 499) THEN
        dbms_output.put_line('Check the URL.');
        utl_http.end_response(l_http_resp);
        -- Look for server-side error and report it.
      elsif (l_http_resp.status_code >= 500) AND (l_http_resp.status_code <= 599) THEN
        dbms_output.put_line('Check if the Web site is up.');
        utl_http.end_response(l_http_resp);
        RETURN;
      END IF;
      utl_http.end_response (l_http_resp);
    EXCEPTION
    WHEN OTHERS THEN
      dbms_output.put_line (sqlerrm);
      raise;
    END; and executing in sqldeveloper 3.2.20.09 when connecting directly to box B as scott:
    SET serveroutput ON
    DECLARE
      l_url      VARCHAR2(200)   :='http://MY_IP:8585/apex/demo';
      l_json     VARCHAR2(20000) := '{"title":"thetitle","description":"thedescription"}';
      l_response VARCHAR2(30000);
    BEGIN
      post( p_url => l_url, p_message =>l_json, p_response => l_response);
    END;which resulted in :
    anonymous block completed
    status code: 200
    reason phrase: OK
    with data inserted. Setup using 2.0.1
       Workspace : wsdemo
    RESTful Service Module:  demo/
              URI Template:      test
                    Method:  POST
               Source Type:  PL/SQLand executing in sqldeveloper 3.2.20.09 when connecting directly to box B as scott:
    SET serveroutput ON
    DECLARE
      l_url      VARCHAR2(200)   :='http://MY_IP:8585//apex/wsdemo/demo/test';
      l_json     VARCHAR2(20000) := '{"title":"thetitle","description":"thedescription"}';
      l_response VARCHAR2(30000);
    BEGIN
      post( p_url => l_url, p_message =>l_json, p_response => l_response);
    END;which resulted in :
    status code: 500
    reason phrase: Internal Server Error
    Listener's log:
    Request Path passes syntax validation
    Mapping request to database pool: PoolMap [_poolName=apex, _regex=null, _workspaceIdentifier=WSDEMO, _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 candidate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=2648625079503782|2797815111031405, uriTemplate=demo/test], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logonConfig=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 candidate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=2648625079503782|2797815111031405, uriTemplate=demo/test], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logonConfig=LogonConfig [logonForm=null, logonFailed=null]], originsAllowed=[], corsEnabled=true] for: POST demo/test
    demo/test is a public resource
    Using generator: oracle.dbtools.rt.plsql.AnonymousBlockGenerator
    Performing JDBC request as: SCOTT
    Mar 28, 2013 1:29:28 PM oracle.dbtools.common.jdbc.JDBCCallImpl execute
    INFO: Error occurred during execution of: [CALL, begin
    insert into scott.json_demo values(/*in:title*/?,/*in:description*/?);
    end;, [title, in, class oracle.dbtools.common.stmt.UnknownParameterType], [description, in, class oracle.dbtools.common.stmt.UnknownParameterType]]with values: [thetitle, thedescription]
    Mar 28, 2013 1:29:28 PM oracle.dbtools.common.jdbc.JDBCCallImpl execute
    INFO: ORA-06550: line 1, column 6:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare exit for goto if loop mod null pragma
       raise return select update while with <an identifier>
       <a double-quoted delimited-identifier> <a bind variable> <<
       close current delete fetch lock insert open rollback
       savepoint set sql execute commit forall merge pipe
    The symbol "" was ignored.
    ORA-06550: line 2, column 74:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare end exception exit for goto if loop mod
       null pragma raise return select update while with
       <an identifier> <a double-quoted delimited-id
    java.sql.SQLException: ORA-06550: line 1, column 6:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare exit for goto if loop mod null pragma
       raise return select update while with <an identifier>
       <a double-quoted delimited-identifier> <a bind variable> <<
       close current delete fetch lock insert open rollback
       savepoint set sql execute commit forall merge pipe
    The symbol "" was ignored.
    ORA-06550: line 2, column 74:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare end exception exit for goto if loop mod
       null pragma raise return select update while with
       <an identifier> <a double-quoted delimited-id
            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.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            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:242)
            at oracle.ucp.jdbc.proxy.PreparedStatementProxyFactory.invoke(PreparedStatementProxyFactory.java:124)
            at oracle.ucp.jdbc.proxy.CallableStatementProxyFactory.invoke(CallableStatementProxyFactory.java:101)
            at $Proxy46.execute(Unknown Source)
            at oracle.dbtools.common.jdbc.JDBCCallImpl.execute(JDBCCallImpl.java:44)
            at oracle.dbtools.rt.plsql.AnonymousBlockGenerator.generate(AnonymousBlockGenerator.java:176)
            at oracle.dbtools.rt.resource.templates.v2.ResourceTemplatesDispatcher$HttpResourceGenerator.response(ResourceTemplatesDispatcher.java:309)
            at oracle.dbtools.rt.web.RequestDispatchers.dispatch(RequestDispatchers.java:88)
            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)
    Error during evaluation of resource template: ORA-06550: line 1, column 6:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare exit for goto if loop mod null pragma
       raise return select update while with <an identifier>
       <a double-quoted delimited-identifier> <a bind variable> <<
       close current delete fetch lock insert open rollback
       savepoint set sql execute commit forall merge pipe
    The symbol "" was ignored.
    ORA-06550: line 2, column 74:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
       begin case declare end exception exit for goto if loop mod
       null pragma raise return select update while with
       <an identifier> <a double-quoted delimited-idPlease advise.
    Regards
    Zack

    Zack.L wrote:
    Hi Andy,
    Sorry, forgot to post the Source that's use by both AL1.1.4 and AL2.0.1.
    Source
    begin
    insert into scott.json_demo values(:title,:description);
    end;
    it's failing during the insert?
    Yes, it failed during insert using AL2.0.1.
    So the above statement produces the following error message:
    The symbol "" was ignored.
    ORA-06550: line 2, column 74:
    PLS-00103: Encountered the symbol "" when expecting one of the following:
    begin case declare end exception exit for goto if loop mod
    null pragma raise return select update while with
    <an identifier> <a double-quoted delimited-idThis suggests to me that an unprintable character (notice how there is nothing between the double quotes - "") has worked its way into your PL/SQL Handler. Note how the error is reported to be a column 74 on line 2, yet line 2 of the above block should only have 58 characters, so at a pure guess somehow there's extra whitespace on line 2, that is confusing the PL/SQL compiler, I suggest re-typing the PL/SQL handler manually and seeing if that cures the problem.

  • Using Native Oracle XML DB Web Services - REST POST web service possible?

    My goal is to expose some pl/sql procedures as a REST web services.
    The Database is 11gR2
    The request method needs to be a POST (not GET as a request will perform insert/updates ) - the request body will contain a xml structure
    Have setup XMLDB Database-native Web Services as per
    11g documentation "Using Native Oracle XML DB Web Services"
    It seems this setup support only SOAP requests!?
    RESTful webservice with GET is (sort of) supported using
    Embedded PL/SQL Gateway as describer here:
    http://ora-00001.blogspot.com/2009/07/creating-rest-web-service-with-plsql.html
    Although no support for POST
    Obviously the post is from 2009 so just want to know if anything changed since.
    Has anyone found a way to expose pl/sql procedures using XML DB or other approach as a REST POST web services?
    (As the relative low number of calls/hour and also the aim to have the least amount of moving parts therefor looking for a DB centric solution)
    Thanks
    Pete

    I think the post referred to was more an exercise of what could be achieved. The quickest way, nowadays, to get this done with not too much hassle is via APEX
    http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35128/restful_svc.htm
    M.

  • ORACLE APEX POST Restful Web services

    Any examples and/or ideas into how to insert a XML or JSON style document into column with XMLtype, varchar2, clob or blob type using an Apex post restful web service? I don't want to use SQL loader, external tables or something that requires a directory in the database server. 
    Oracle Apex 4.2
    Apache tomcat 7 web server
    Oracle Apex Listener 2.0
    Oracle database 11.2.0.3
    thank you!

    MK,
    I am able to insert into a table the following json document;
    {"name": "John", "age": "21"}
    Here is the code behind it.
    <code>
    create table students (
    name varchar2(100),
    age varchar2(100));
    begin
    insert into students(name, age)
    values(:name, :age);
    end;
    </code>
    This works, But the following will fail,
    {"name": "John", "age": "21"}, {"name": "Mary", "age": "22"}.
    I would like to load the document into memory and insert into a table.

  • How to POST the data though Rest services though composite object.

    I am new to REST services.
    I need to write REST Serivices to post(Update) the data using Composite object.
    I created the structure to pass the composite object from jquery to the REST services.
    How can i handle that composite object in REST Services URITemplate and interface methods.
    can i have sample code to handle the composite object in REST Services?
    Thanks in advance.

    Did you check this post?
    http://sharepoint.stackexchange.com/questions/25222/posting-json-to-a-rest-wcf-endpoint-in-sharepoint-using-cksdev
    --Cheers

  • [OSB] - Calling REST Service - POST action

    Hi,
    I have a requirement to invoke a REST full service to pass on the processed XML message. I know OSB supports both calls via Proxy and Business services. I have tested it with HTTP and it works. However, my server side REST service is to be invoked/called over HTTPS.
    Request you to please let me know what I need to look for while implementing this requirement. Any help in this case will be appreciated. Thanks.
    Regards.

    Please refer - for Post implementation
    http://blogs.oracle.com/jeffdavies/entry/restful_services_with_oracle_s_1

  • RESTful service with POST, GET, PUT and DELETE

    I'm implementing a RESTful service, but mod_plsql only gives me GET, POST and HEAD commands.
    However, if I try to use the PUT command, the response is:
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <HTML><HEAD>
    <TITLE>501 Method Not Implemented</TITLE>
    </HEAD><BODY>
    <H1>Method Not Implemented</H1>
    PUT to *** not supported.<P>
    mod_plsql: request method not supported<P>
    <HR>
    <ADDRESS>Oracle-Application-Server-10g/10.1.3.1.0 Oracle-HTTP-Server Server at *** Port 80</ADDRESS>
    </BODY></HTML>Is it possible to add support for PUT and DELETE in mod_plsql?
    I've search all packages and code, but I haven't found anything that specifies the valid HTTP commands or the source for generating the above error message.

    AIR supports all the specified HTTP methods, but there seems to be a bug in the HTTPService class. Instead you should use URLLoader and URLRequest. If you change to that you won't even need to use the Method Override header.
    Read more here : http://spy6.blogspot.com/2009/06/adobe-air-put-delete-head-http-methods.html .

  • REST (HTTP POST) Proxy Service in OSB 11g

    Hi everyone,
    I am pretty new to Oracle OSB, but I was searching through the forum but could not find any "guide", "tutorial" on how to implement a REST - HTTP Post for a Proxy Service. If anyone know of any disccussions prior, please send me the links!
    I have created a SOAP business service based on a WSDL, I have it working with a SOAP proxy service, but I want to implement a REST - HTTP Post proxy service to talk to the same SOAP business service. Can this be done? And if so, can someone guide me on how to create the HTTP Post Proxy service? I have tried implementing a proxy with the relative uri, http, but just could not get it to work, any help would be appreciated!
    THANKS!
    -ML

    Hi!
    A few links to help you on your way :
    http://blogs.oracle.com/jamesbayer/2008/07/using_rest_with_oracle_service.html
    http://blogs.oracle.com/christomkins/2008/10/a_look_at_oracle_service_bus_1.html
    http://blogs.oracle.com/jeffdavies/2009/06/restful_services_with_oracle_s_1.html
    http://www.oracle.com/technology/sample_code/products/osb/index.html (REST-2-REST Routing )
    http://wiki.oracle.com/page/Chapter+13+-TheOracle+Service+Bus
    http://biemond.blogspot.com/2009/05/osb-rest-service-with-xml-json-output.html

  • How to call rest service with POST Http method in SMP2.3 HWC?

    Hi Experts,
       I am doing a sample for Rest Service in smp.
    http://192.168.1.119:8086/Test/services/Products
    I am calling the above service in the smp it is pulling the data from the service with GET Http Method.
    Now i want to call this service for login functionality.
    http://192.168.1.119:8086/Test/services/auth?uname=:uname&pass=:pass
    here :uname &:pass values are argument values for the uname & pass.
    the output of the service is
    http://192.168.1.119:8086/Test/services/auth?uname=sravanya.k&pass=sravanya
    <?xml version="1.0" encoding="UTF-8"?>
    <details>
    <responsecode>200</responsecode>
    <profile>
    <firstname>sravanya</firstname>
    <lastname>k</lastname>
    <email>[email protected]</email>
    <chart_type>North</chart_type>
    <location>MACHILIPATNAM</location>
    <language>English</language>
    </profile>
    </details>
    How can i do this?
    Thanks & Regards,
    Sravanya K

    Create a uriTemplate like this
    /auth?uname={uname}&pass={pass}
    use GET method only.
    generate the personalization keys.

  • How do I insert multiple rows from a single form ...

    How do I insert multiple rows from a single form?
    This form is organised by a table. (just as in an excel format)
    I have 20 items on a form each row item has five field
    +++++++++++ FORM AREA+++++++++++++++++++++++++++++++++++++++++++++++++++++
    +Product| qty In | Qty Out | Balance | Date +
    +------------------------------------------------------------------------+
    +Item1 | textbox1 | textbox2 | textbox3 | date +
    + |value = $qty_in1|value= &qty_out1|value=$balance1|value=$date1 +
    +------------------------------------------------------------------------+
    +Item 2 | textbox1 | textbox2 | textbox4 | date +
    + |value = $qty_in2|value= $qty_out1|value=$balance2|value=$date2 +
    +------------------------------------------------------------------------+
    + Item3 | textbox1 | textbox2 | textbox3 | date +
    +------------------------------------------------------------------------+
    + contd | | | +
    +------------------------------------------------------------------------+
    + item20| | | | +
    +------------------------------------------------------------------------+
    + + + SUBMIT + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Database Structure
    +++++++++++++++++
    + Stock_tabe +
    +---------------+
    + refid +
    +---------------+
    + item +
    +---------------+
    + Qty In +
    +---------------+
    + Qty Out +
    +---------------+
    + Balance +
    +---------------+
    + Date +
    +++++++++++++++++
    Let's say for example user have to the use the form to enter all 10 items or few like 5 on their stock form into 4 different textbox field each lines of your form, however these items go into a "Stock_table" under Single insert transaction query when submit button is pressed.
    Please anyone help me out, on how to get this concept started.

    Hello,
    I have a way to do this, but it would take some hand coding on your part. If you feel comfortable hand writing php code and doing manual database calls, specificaly database INSERT calls you should be fine.
    Create a custom form using the ADDT Custom Form Wizard that has all the rows and fields you need. This may take a bit if you are adding the ability for up to 20 rows, as per your diagram of the form area. The nice thing about using ADDT to create the form is that you can setup the form validation at the same time. Leave the last step in the Custom Form Wizard blank. You can add a custom database call here, but I would leave it blank.
    Next, under ADDT's Forms Server Behaviors, select Custom Trigger. At the Basic tab, you enter your custom php code that will be executed. Here you are going to want to put your code that will check if a value has been entered in the form and then do a database INSERT operation on the Stock_table with that row. The advanced tab lets you set the order of operations and the name of the Custom Trigger. By default, it is set to AFTER. This means that the Custom Trigger will get executed AFTER the form data is processed by the Custom Form Transaction.
    I usually just enter TEST into the "Basic" tab of the Custom Trigger. Then set my order of operations in the "Advanced" tab and close the Custom Trigger. Then I go to the code view for that page in Dreamweaver and find the Custom Trigger function and edit the code manually. It's much easier this way because the Custom Trigger wizard does not show you formatting on the code, and you don't have to keep opening the Wizard to edit and test your code.
    Your going to have to have the Custom Trigger fuction do a test on the submitted form data. If data is present, then INSERT into database. Here's a basic example of what you need to do:
    In your code view, the Custom Trigger will look something like this:
    function Trigger_Custom(&$tNG) {
    if($tNG->getColumnValue("Item_1")) {
    $item1 = $tNG->getColumnValue("Item_1");
    $textbox1_1 = $tNG->getColumnValue("Textbox_1");
    $textbox1_2 = $tNG->getColumnValue("Textbox_2");
    $textbox1_3 = $tNG->getColumnValue("Textbox_3");
    $date1 = $tNG->getColumnValue("Textbox_3");
    $queryAdd = "INSERT INTO Stock_table
    (item, Qty_In, Qty_Out, Balance, Date) VALUES($item1, $textbox1_1, $textbox1_2, $textbox1_3, $date1)"
    $result = mysql_query($queryAdd) or die(mysql_error());
    This code checks to see if the form input field named Item_1 is set. If so, then get the rest of the values for the first item and insert them into the database. You would need to do this for each row in your form. So the if you let the customer add 20 rows, you would need to check 20 times to see if the data is there or write the code so that it stops once it encounters an empty Item field. To exit a Custom Trigger, you can return NULL; and it will jump out of the function. You can also throw custom error message out of triggers, but this post is already way to long to get into that.
    $tNG->getColumnValue("Item_1") is used to retrieve the value that was set by the form input field named Item_1. This field is named by the Custom Form Wizard when you create your form. You can see what all the input filed names are by looking in the code view for something like:
    // Add columns
    $customTransaction->addColumn("Item_1", "STRING_TYPE", "POST", "Item_1");
    There will be one for each field you created with the Custom Form Wizard.
    Unfortunately, I don't have an easy way to do what you need. Maybe there is a way, but since none of the experts have responded, I thought I would point you in a direction. You should read all you can about Custom Triggers in the ADDT documentation/help pdf to give you more detailed information about how Custom Triggers work.
    Hope this helps.
    Shane

  • Rest service DELETE doesn't work with OSB

    Hi,
    I am using OSB 11g, I am using OSB proxy to monitor external rest services call. I've created a business service that point to the external rest service and I created a proxy that is routed to my business service. I modified the flow by adding a piplinepairNode -->requestPipline-->stage -->created two assign and created two variable one for the id and another one for the productID. Then I modified the business service flow as follow:
    created two insert, one to define the method, which is DELETE and another one to set the relative-URI to the productID variable and I set the response to replace the . in the body with $body, following this post: http://blogs.oracle.com/jeffdavies/entry/restful_services_with_oracle_s_1
    When I test it using osb console Execute, I can see my productID variable is set to $inbound and it is passed all the way to the business service, where it should call the external rest service with the relative-URI, which is set to my productID. it doesn't work, I get 404 error, which is undefined, I believe the reason is because business service is trying to call the external rest service with
    http://localhost:{port}/deleteProduct and the rest service expect this URL
    http://localhost:{port}/deleteProduct/2 or {productID}
    can you please help and tell me what I'm doing wrong?
    appreciate any kind of help
    Thanks
    M.

    Please refer -
    http://blogs.oracle.com/jeffdavies/entry/enhanced_rest_support_in_oracl
    Regards,
    Anuj

  • InfoPath combined with Excel Rest services gives State service error

    Hi
    I'm having a problem with InfoPath and Excel Services. I have a InfoPath form that calls Excel to do a fairly simple calculation, but I also have another form at a client that is doing the same calling a much more complicated function.
    The error I get is
    SharePoint Server
    State Service
    bm1k
    Medium
    StateSqlSession.GetItemBytesInternal() Locked row in database for key ba18f90ee2e844468b08e90ad96dff2c_05967b71a21948d39b7d4d3ada9b27c9 for 4 seconds
    SharePoint Server
    State Service
    bm0t
    Unexpected
    StateManager.GetState() Locked data (05967b71-a219-48d3-9b7d-4d3ada9b27c9)
    InfoPath Forms Services
    Runtime - State Service
    b5st
    Medium
    MOSS StateService threw an exception: A Microsoft SharePoint Server State Service error occurred while processing your request. For more information, contact your server farm administrator.
    I have determined that if the user is in the Members group, then it works, but as soon as the user is in another group, it gives the error. I have played around with permission levels, given the user all rights, but it still gives that error.
    Does anyone have any idea about what might be the problem? I have thought that it's a problem on the state service, but it isn't configurable. I don't want to resort to put everyone into the Members group, as that doesn't seem to be a solution that will
    work with everyone. We are on the June 2012 CU.

    Thanks Sergio. I tried that but unfortunately didn't fix the problem. I have given the groups Contribute rights, Full Control rights, create my own custom permission level, nothing works except when the user is in the Members post. 
    I realised today that the error I posted above is a bit misleading. The error that happens first before that one is this (after removing timestamps and correlations):
    Entering monitored scope (Request (POST:https://<server>/ContentHub/_layouts/Postback.FormServer.aspx))
    Name=Request (POST:https://<server>/ContentHub/_layouts/Postback.FormServer.aspx)
    Site=/
    Access denied.
    Thread was being aborted.
    Not persisting state for request due to previous errors. Form Template: urn:schemas-microsoft-com:office:infopath:Expense-Claims-With-Excel:-myXSD-2004-12-26T20-14-04
    Unhandled exception processing request for PostbackPage Microsoft.Office.InfoPath.Server.Util.InfoPathFatalException: Exception of type
    'Microsoft.Office.InfoPath.Server.Util.InfoPathFatalException' was thrown.
    at Microsoft.Office.InfoPath.Server.Util.GlobalStorage.get_CurrentFormId()
    at Microsoft.Office.InfoPath.Server.Util.GlobalStorage.get_CurrentContext()
    at Microsoft.Office.InfoPath.Server.Util.GlobalStorage.IsDefined(GlobalItems key)
    at Microsoft.Office.InfoPath.Server.Controls.DateFormattingInfo.TryGetCachedTimeZoneId(UInt16& timeZoneId)
    at Microsoft.Office.InfoPath.Server.Controls.DateFormattingInfo.GetSPTimeZoneObject()
    at Microsoft.Office.InfoPath.Server.Controls.DateFormattingInfo.CalculateSPLocalTimeOffset()
    at Microsoft.Office.InfoPath.Server.Util.GenericUtils.GetServerTimeZone()
    at Microsoft.Office.InfoPath.Server.DocumentLifetime.ErrorPageRenderer.RenderResult(TextWriter writer, Document document, EventLogStart eventLogStart)
    at Microsoft.Office.InfoPath.Server.DocumentLifetime.ErrorPageRenderer.RenderForException(HttpContext context, Exception exception, Document document, EventLogStart eventLogStart)
    at Microsoft.Office.InfoPath.Server.Controls.PostbackPage.OnPreInit(EventArgs e)
    at System.Web.UI.Page.PerformPreInit()
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    The error I first posed is I think the reaction to this exception. The strange thing is that the user can access the spreadsheet fine. When I go to the URL that is used for the rest service and just remove the $format parameter, it displays it fine as a HTML
    value.

  • RESTful service and BLOB with bind variable

    Hi,
    Has anyone successfully created a RESTful service with bind variable to retrieve a BLOB field and render it in an Apex app? I can create RESTful web service and render BLOB field for a record with no bind variable (single row). As soon as I add bind variable my RESTful service fails -- I get 404 Error. Without bind variable it renders both in TEST tool of Workspace and direct URL. As soon as I add a bind variable it fails either way. I have reported this in an SR to Oracle support, but thought I would post here too.
    I would also like to retrieve the photo into an Apex application. Any hints would be appreciated.
    Thanks,
    Pat

    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

  • APEX Listener 2.0 - RESTful Services Failure with  404 - Not Found

    Versions used:
    * APEX Listener 2.0.0.354.17.05
    * Application Express 4.2.1.00.08
    * Oracle Database 11.2.0.1
    When testing the sample RESTful Service Module oracle.example.hr I always get 404 - Not Found page.
    I followed the documentation to install and configure APEX 4.2 and the Listener 2.0. Everything in my APEX installation works fine except RESTful Services.
    For example, when calling this RESTful Service:
    http://company.com:45678/apex/DEV/xxuapex/hr/empinfo/
    I get a 404 page.
    The corresponding entry in url-mapping.xml is:
    <pool base-path="/DEV" name="od01" workspace-id="xxuapex"/>
    where xxuapex is the name of the schema as well as the workspace where the RESTful Service is installed.
    Moreover, the corresponding od01.xml, od01_rt.xml and od01_al.xml in the conf directory seem correct.
    Any help is greatly appreciated.
    Thanks.
    Eddie Awad.

    Hi Eddie,
    +> try the other option base-url of the url-mapping+
    I did. No change. Still getting 404.When active it should transform the 404 page into a detailed 404 with a description of what the error is. Just to be sure, this is activated in the defaults.xml file of the APEX Listener as: *<entry key="log.logging">true</entry>*.
    You should then see a detailed 404 output in your browser of what's going wrong first of all.
    +> Could you post your url-mapping.xml file?+
    <?xml version="1.0" encoding="UTF-8"?>
    <pool-config xmlns="http://xmlns.oracle.com/apex/pool-config">
    <pool base-path="/DEV" name="od01" workspace-id="xxuapex"/>
    <pool base-path="/TEST" name="ot01" workspace-id="xxuapex"/>
    </pool-config>
    Despite using the url mapping script, it didn't map mine correctly and had to edit it manually. It was the use of "apex" that got it to work for me:
    *<pool base-path="/" name="apex" workspace-id="workspace-name-here" updated="2013-01-09T20:48:59.75Z"/>*
    Nick.

Maybe you are looking for