Skip to Main Content

ORDS, SODA & JSON in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using REST and JSON

Richard LeggeOct 9 2017 — edited Oct 9 2017

Hi All,

APEX 5.1, SE 12.1

I've created some rest data services in the database using ORDS.Define etc, and I can successfully call the service from postman. I can't however register it in APEX

here is an example of my ORDS service

ORDS.define_handler(

    p_module_name    => 'invoice',

    p_pattern        => 'create/',

    p_method         => 'POST',

    p_source_type    => ORDS.source_type_plsql,

    p_source         => 'DECLARE

                         ret varchar2(255);

                         err_msg VARCHAR2(100);

                         BEGIN

                          ret := CF_INVOICE.INS_INVOICE (

                          P_SUPPLIER_ID => :SUPPLIER_ID,

                          P_INV_REF => :INV_REF,

                          P_ENTITY_BANK_ACC => :BANK_ACC_ID,

                          P_INV_DATE => to_date(:INV_DATE,''DD-MON-YYYY''),

                          P_COMMENTS => :COMMENTS,

                          P_ENTITY_BUDGET_CAT_ID => :ENTITY_BUDGET_CAT_ID,

                          P_SUBJECT => :SUBJECT,

                          P_CREATED_BY => ''WEB SERVICE'');

                          htp.print(''{ "INVOICE_ID": ''||ret||'' }'');

                          EXCEPTION

                          WHEN OTHERS THEN

                             err_msg := SUBSTR(SQLERRM, 1, 100);

                            htp.print(''{ "Error": "''||err_msg||''" }'');                        

                         END;',

    p_items_per_page => 0);

then in postman, I call  http://192.168.0.72:8090/apex/vrs/invoice/create/

{ "SUPPLIER_ID": "888893951", "INV_REF": "Test Ref", "ENTITY_BANK_ACC": "1346", "INV_DATE": "01-MAR-2017", "COMMENTS": "Test Comments", "ENTITY_BUDGET_CAT_ID": "201", "SUBJECT": "Test Subject" }

This all works fine, and I get an invoice inserted, and an invoice number back.

However, Im trying to register this as a Web Service in APEX (shared components\Web Service References. ).  Web Reference   REST, Type = POST, and fill in the input parameters. When I try testing it, I get ORA-1403 no data found.

Why would this work fine using postman, but when I try in APEX I get an error?

If anyone can help.

Many Thanks

Richard

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 6 2017
Added on Oct 9 2017
0 comments
282 views