Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Create A Custom Business Entity:: How To Convert Custom PLSQL To Web Services

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

How to Convert Custom PLSQL to Web services

Create a Custom Business Entity:

Application Developer->Application->Lookups->Application Object Library

Code : DSI_BUS_ENTITY

Create your Custom package with Annotations only in the spec :

CREATE OR REPLACE PACKAGE DSI_GET_ITEM_ID AS


/* $Header: $ */
/*#
* This custom PL/SQL package can be used to retrieve item id
* @rep:scope public
* @rep:product INV
* @rep:lifecycle active
* @rep:compatibility S
* @rep:displayname Get Item Number
* @rep:category BUSINESS_ENTITY DSI_BUS_ENTITY
*/

/*#
* Use this method to get item identifier
* @param p_item_number item number
* @param p_org_id organization identifier
* @param x_item_id item identifier
* @param x_status status
* @param x_err_msg error message
* @rep:scope public
* @rep:lifecycle active
* @rep:displayname Get Item Identifier
*/

procedure get_item_id
(p_item_number in VARCHAR2,
p_org_id in NUMBER,
x_item_id out NUMBER,
x_status out VARCHAR2,
x_err_msg out VARCHAR2
);

END DSI_GET_ITEM_ID;

Create your Custom package body :

CREATE OR REPLACE PACKAGE BODY DSI_GET_ITEM_ID AS

procedure get_item_id
(p_item_number in VARCHAR2,
p_org_id in NUMBER,
x_item_id out NUMBER,
x_status out VARCHAR2,
x_err_msg out VARCHAR2
)
IS
v_item_id number;
end_chk_excep exception;
BEGIN

begin
select inventory_item_id
into v_item_id
from mtl_system_items_b
where 1=1
and segment1=p_item_number
and organization_id=p_org_id;
exception when no_data_found then
x_status:='E';
x_err_msg:='Item Number Entered does not exist';
raise end_chk_excep;
end;

x_item_id := v_item_id;
x_status:='S';
x_err_msg:='DSI Custom Rest Service Successful';

exception
when end_chk_excep then
x_status := 'E';
x_err_msg := x_err_msg || ' - ' || sqlerrm;
when others then
x_status:='E';
x_err_msg:='Item Number Entered is not valid';

END GET_ITEM_ID;

END DSI_GET_ITEM_ID;

Connect to application server with FTP and upload pls file into INV_TOP :

Give permissions:

Connect to application server using putty tool and run the following unix command. This command
runs a perl script which is going to parse your pls file according to the annotations and generates an
ildt file.
$IAS_ORACLE_HOME/perl/bin/perl $FND_TOP/bin/irep_parser.pl -g -v -username=sysadmin
INV:patch/115/sql:DSI_GET_ITEM_ID:12.0=patch/115/sql/DSI_GET_ITEM_ID.pls

If there are no errors, ildt file would be generated:

Give permissions so the file can be accessed :

chmod 777 DSI_GET_ITEM_ID.ildt

To upload ILDT file into Oracle EBS, run the following command :

$FND_TOP/bin/FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/wfirep.lct


DSI_GET_ITEM_ID.ildt

Log on to the applications with SYSADMIN username and click on the Integration Repository:
Navigate to Oracle Supply Chain Management Family->Oracle Inventory Management:

Click on DSI Custom Business Entity


Click on the ‘Generate WSDL’ button and once the WSDL is generated you can click on the ‘Create
Grant’ button and give Grants :

You can ‘Deploy’ the web service by clicking the ‘Deploy’ button, you can always redeploy or un
deploy the service:
Before Invoking the Webservice :

cd $INST_TOP/admin/scripts

adoafmctl.sh stop
adoacorectl.sh stop

adoafmctl.sh start
adoacorectl.sh start

Clear cache

Use responsibility Functional Administrator and go to Core Services -> Caching Framework -> Global
Configuration -> Clear all cache.

Now to test the web service , you can use tools like SOAP UI :

The url to be passed into the SOAP UI can be seen in the WSDL File generated : (look for soap address
location)

Pass in the parameters correctly :

Responsibility Key : INVENTORY_VISION_OPERATIONS

RespApplication : INV

SecurityGroup : STANDARD

NLSLanguage : AMERICAN

Org_Id : 204

For Authentication, enter the username/password in the request properties and click on the ‘Green
arrow-Submit Request to specified Url) button on the SOAP UI
USING REST WEBSERVICES :

Follow same steps above till you log on to the Applications.

Log on to the applications with SYSADMIN username and click on the Integration Repository:

Navigate to Oracle Supply Chain Management Family->Oracle Inventory Management:

Click on DSI Custom Business

Click on REST Web Service Tab , select the method you want to POST and click on ‘DEPLOY’ :

Click on Grants Tab:

Select Group of Users and select ‘Inventory Vision Operations (USA)’ and then click on the WADL link :
Copy the link for XSD File and paste in the browser :

Now to test it download ‘POST MAN’ a google chrome extension and the URL would be combination
of links from WADL file above .

URL – RESOURCES BASE + RESOURCE PATH


Under Authorization Tab , select Basic Auth and enter the username/password :

Under Headers, you should have the following : Note that Authorization : Basic ‘Uniquekey’ will be
generated by the Tool

Content-Type:application/xml
Authorization:Basic TUZHOndlbGNvbWU=
Accept:application/xml
Content-Language:en-US

In the Body Section :

Prepare the PAYLOAD :

<?xml version="1.0" encoding="UTF-8"?>


<ns:GET_Input xmlns:ns="http://xmlns.oracle.com/apps/inv/rest/ItemInfo/get_item_id/"
xmlns:ns1="http://xmlns.oracle.com/apps/inv/rest/ItemInfo/header">
<ns1:RESTHeader>
<ns1:Responsibility>INVENTORY_VISION_OPERATIONS</ns1:Responsibility>
<ns1:RespApplication>INV</ns1:RespApplication>
<ns1:SecurityGroup>STANDARD</ns1:SecurityGroup>
<ns1:NLSLanguage>AMERICAN</ns1:NLSLanguage>
<ns1:Org_Id>204</ns1:Org_Id>
</ns1:RESTHeader>
<ns:InputParameters>
<ns:P_ITEM_NUMBER>AS54888</ns:P_ITEM_NUMBER>
<ns:P_ORG_ID>207</ns:P_ORG_ID>
</ns:InputParameters>
+
</ns:GET_Input>

The REST Header should be the combination of


ResponsibilityKey+ApplicationShortname+SecurityGroup+Language+Orgid
The path highlighted in RED can be found from the XSD File as targetNamespace + import
namespace(ending with header):

The input parameters are also found in the xsd file :

Click on ‘Send’ to check out the output :

You might also like