INTEGRATED
SOA GATEWAY- REST SERVICE
1-Rest Service Creation
2-Rest Service Deployment
a-Prepare Payload
3-Rest Service Test
4-Rest Service Deletion
1-Rest Service Creation
Package Spec
CREATE OR REPLACE PACKAGE "XXNTC_ITEM_DETAIL_WS" AS
/* $Header: $ this is the
XXNTC_ITEM_DETAIL_WS package spec */
/*#
* This interface returns the
Item Detail Info.
* @rep:scope public
* @rep:product PER
* @rep:displayname
XXNTC_ITEM_DETAIL_WS
* @rep:lifecycle active
* @rep:compatibility S
* @rep:category
BUSINESS_ENTITY PER_EMPLOYEE
*/
/*#
* Returns Item Detail Info
* @param p_item_code varchar2
ROWNUM
* @return
xxntc_item_detail_tbl
* @rep:scope public
* @rep:lifecycle active
* @rep:displayname Return xxntc_item_detail_tbl
*/
FUNCTION get_item_detail ( p_item_code in varchar2
) RETURN xxntc_item_detail_tbl ;
TYPE c_list IS TABLE OF c_rec;
/*#
* Returns set inv item detail
* @param p_segment1 c_list
c_list
* @param p_result VARCHAR2 ROWNUM
* @rep:scope public
* @rep:lifecycle active
* @rep:displayname Insert inv
item List
*/
PROCEDURE set_inv_detail ( p_segment1 in c_list,p_result out varchar2) ;
/*#
* Returns Item description
* @param p_item_segment1
varchar2 ROWNUM
* @return itemdescription
* @rep:scope public
* @rep:lifecycle active
* @rep:displayname Return
itemdescription
*/
FUNCTION get_item_description
( p_item_segment1 in varchar2
) RETURN varchar2 ;
END XXNTC_ITEM_DETAIL_WS;
Table, Sequnce ve Type definition below.
CREATE OR REPLACE TYPE c_rec AS OBJECT
(
segment1 VARCHAR2(100)
);
/
CREATE OR REPLACE TYPE c_list IS TABLE OF c_rec;
/
create table xxntc.xxntc_segment1
(
inv_id number,
segment1 varchar2 (100)
);
CREATE SEQUENCE XXNTC.xxntc_segment1_s
START WITH 100000
MAXVALUE 999999999999999999999999999
MINVALUE 1
NOCYCLE
CACHE 20
Package Body
CREATE OR REPLACE PACKAGE BODY "XXNTC_ITEM_DETAIL_WS"
IS
FUNCTION get_item_detail (p_item_code IN VARCHAR2)
RETURN xxntc_item_detail_tbl
AS
sql_errm varchar2(1000);
v_ret
xxntc_item_detail_tbl;
BEGIN
SELECT xxntc_item_detail_rec (
msi.inventory_item_id,
msi.CONCATENATED_SEGMENTS,
msi.description,
org.organization_name,
msi.inventory_item_status_code,
msi.item_type,
msi.purchasing_tax_code)
BULK COLLECT INTO v_ret
FROM
mtl_system_items_kfv msi,
org_organization_definitions org
WHERE 1 = 1
AND msi.concatenated_segments =
NVL (p_item_code, msi.concatenated_segments)
AND org.organization_id = msi.organization_id;
RETURN v_ret;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (SQLERRM);
END get_item_detail;
PROCEDURE set_inv_detail (p_segment1 IN c_list,
p_result OUT VARCHAR2)
IS
err
VARCHAR2 (500);
ap
c_rec;
l_inv_id
number;
BEGIN
FOR i IN 1 .. p_segment1.COUNT
LOOP
ap := p_segment1 (i);
DBMS_OUTPUT.PUT_LINE (ap.segment1);
select XXNTC.xxntc_segment1_s.nextval INTO l_inv_id from dual;
insert into xxntc.xxntc_segment1
values (l_inv_id,ap.segment1);
END LOOP;
COMMIT;
p_result := 'true';
EXCEPTION
WHEN OTHERS
THEN
p_result := 'false';
err :=
'Unexpected
error inserting in header staging table. = '
|| SQLERRM;
DBMS_OUTPUT.PUT_LINE (SQLERRM);
END set_inv_detail;
FUNCTION get_item_description
( p_item_segment1 in varchar2
) RETURN varchar2 AS
l_return_msg VARCHAR2 (2000);
l_item_desc varchar2(500);
BEGIN
select description INTO l_item_desc from mtl_system_items_kfv where organization_id = 121 and CONCATENATED_SEGMENTS
= NVL(p_item_segment1,CONCATENATED_SEGMENTS);
return l_item_desc;
EXCEPTION
WHEN OTHERS
THEN
l_return_msg := SQLCODE || SQLERRM;
RETURN l_return_msg;
DBMS_OUTPUT.put_line (SQLERRM);
END get_item_description;
END XXNTC_ITEM_DETAIL_WS;/
2-Rest Service Deployment
Put package spec on file system a path
-Run this script on this path
$IAS_ORACLE_HOME/perl/bin/perl $FND_TOP/bin/irep_parser.pl
-g -v -username=sysadmin
ihchr:sql:XXNTC_ITEM_DETAIL_WS.pkh:12.0=XXNTC_ITEM_DETAIL_WS.pkh
-See .ildt file created on file system path
- .ildt file load with FNDLOAD to system
$FND_TOP/bin/FNDLOAD apps 0 Y UPLOAD
$FND_TOP/patch/115/import/wfirep.lct
XXNTC_ITEM_DETAIL_WS_pkh.ildt
***** The Service successfully loaded the system.*****
- Go to Responsibility > Integrated
SOA Gateway > Integration
Repository
- Find your custom service which is name "Package Spec"
-Click Grant Tab and Create grant for (Specific User or Group)
- Deploy Service with Service Alias
-Click Rest Web Service Tab and See WADL and needs Payload columns for your custom service.
a- PREPARE EXAMPLE PAYLOAD
Get_item_description methode Payload :
{"GET_ITEM_DESCRIPTION_Input":{
"RESTHeader":{
"Responsibility":"US_HRMS_MANAGER",
"RespApplication":"PER",
"SecurityGroup":"STANDARD",
"NLSLanguage":"AMERICAN"
},
"InputParameters":{
"P_ITEM_SEGMENT1" :
"1-013-001-046"
}
}}
----------------------------------------------------------------------------------------
Get_item_detail methode Payload :
{"GET_ITEM_DETAIL_Input":{
"RESTHeader":{
"Responsibility":"US_HRMS_MANAGER",
"RespApplication":"PER",
"SecurityGroup":"STANDARD",
"NLSLanguage":"AMERICAN"
},
"InputParameters":{
"P_ITEM_CODE" :
"1-013-001-046"
}
}}
----------------------------------------------------------------------------------------
Set_inv_detail methode Payload :
{
"SET_INV_DETAIL_Input":{
"RESTHeader":{
"Responsibility":"US_HRMS_MANAGER",
"RespApplication":"PER",
"SecurityGroup":"STANDARD",
"NLSLanguage":"AMERICAN"
},
"InputParameters":{
"P_SEGMENT1": {
"P_SEGMENT1_ITEM":[
{
"SEGMENT1": "2-001-001-030"
},
{
"SEGMENT1":"1-013-001-046"
},
{
"SEGMENT1":"2-001-003-076-S"
},
{
"SEGMENT1":"2-002-001-020"
}
]
}
}
}
}
3-Rest Service Test
After Deploy the service , Go to Functional Administrator Responsibility.
Clear Cache and statistics.
And test service with SOAP-UI or POSTMan
3-Rest Service Deletion