Académique Documents
Professionnel Documents
Culture Documents
b) Go to View→ Rest Data Services → Development. Create connection as follows. Schema name
must be the name of the schema which was enabled in above step #2.
4) Expose table as Rest web service
https://www.oracle.com/webfolder/technetwork/tutorials/obe/db/ords/r30/AutoREST
%20Enable/AutoREST%20Enable.html#section1
a) Ex: Accept parameter in Json format(3 level) via plsql procedure and provide output in
Json format(3 level). In below scenario we are providing OU name, Order Status and Sold to
Customer name in Json format as parameter to xxrh_ont_ords.get_order.
xxrh_ont_ords.get_order returns order details as response to caller.
I) Create package in database:
BEGIN
OPEN json_cur(p_order_enquiry);
FETCH json_cur INTO r_json_cur;
CLOSE json_cur;
APEX_JSON.initialize_clob_output;
insert into xxrh_ords_temp values('r_json_cur.sold_to_cust:'||r_json_cur.sold_to_cust);
insert into xxrh_ords_temp values('r_json_cur.order_status:'||r_json_cur.order_status);
insert into xxrh_ords_temp values('r_json_cur.order_status:'||r_json_cur.ou_name);
OPEN p_order_out FOR SELECT ooh.order_number
, ooh.sold_to sold_to_customer
, ooh.price_list price_list
, ooh.sold_to_contact
, ooh.flow_status_code
, ooh.org_name
, cursor(
SELECT ool.line_number
,ool.ordered_item
,ool.ordered_quantity
,cursor (
SELECT ools.line_number
, ools.ordered_item
, ools.ordered_quantity
FROM oe_order_lines_all ools
WHERE SERVICE_REFERENCE_LINE_ID = ool.line_id
AND SERVICE_REFERENCE_TYPE_CODE = 'ORDER'
) service_line
FROM xxrhops.xxrh_oe_order_lines_v ool
WHERE ool.header_id = ooh.header_id
AND ool.SERVICE_REFERENCE_LINE_ID is null
) main_line
FROM xxrhops.xxrh_oe_order_headers_v ooh
WHERE header_id in (4076868,4076865,4076864,4076866,4076867,4076863)
AND UPPER(ooh.org_name) = UPPER(r_json_cur.ou_name)
AND UPPER(ooh.sold_to) = UPPER(r_json_cur.sold_to_cust)
AND UPPER(ooh.flow_status_code) = UPPER(r_json_cur.order_status);
END get_order;
END xxrh_ont_ords;
/
→ Create new module as described in oe-pkg module in below image. Here “R1” will be input
parameter to web service in Json format and “orders” is response to caller from web service in Json.
Note the URI from ORDS.
BEGIN
p_organization_rec.organization_name := p_party_name;
p_organization_rec.created_by_module := 'XXRHOPS';
apps.hz_party_v2pub.create_organization (
'T',
p_organization_rec,
x_return_status,
x_msg_count,
x_msg_data,
x_party_id,
x_party_number,
x_profile_id);
dbms_output.put_line(SubStr('x_return_status = '||x_return_status,1,255));
dbms_output.put_line('x_msg_count = '||TO_CHAR(x_msg_count));
dbms_output.put_line(SubStr('x_msg_data = '||x_msg_data,1,255));
FOR I IN 1..x_msg_count
LOOP
dbms_output.put_line(I||'. '||SubStr(apps.FND_MSG_PUB.Get(p_encoded =>
apps.FND_API.G_FALSE ), 1, 255));
END LOOP;
commit;
END IF;
END xxrh_ords_ar_create_party_prc;
II) Create Module with “Post” method and invoke above procedure.
IV) Test Rest Web service “Post” method via SOAP UI.
Post method can only be tested via SOAP UI or any other tool except browser.
Here is the way to test post method and invoke plsql procedure using rest webservice from SOAP
UI. In this considering extample created above in #6(a) and Rest url is
http://localhost:8080/ords/apps/ar/create_party.