使用集成SOA網關的PL / SQL中的RESTweb
Oracle電子商務套件集成SOA網關(ISG)是一款開箱即用的模塊,支持在Oracle Integration Repository中發佈支持的接口類型。這些接口能夠轉換爲SOAP和REST Web服務。請參閱metalink筆記號(文檔ID 1311068.1):在版本12.2中安裝Oracle電子商務套件集成SOA網關sql
高級配置步驟:數據庫
1)Enabling ASADMIN User with the Integration Administrator Role (ASADMIN should be active user and with complex password and should have UMX|FND_IREP_ADMIN role.)
2)Create a folder called ISG_TEMP in Oracle E-Business Suite. This folder should have write permission.
3)In the $INST_TOP\soa folder, update ISG_TEMP_DIRECTORY_LOCATION property in the isgagent.properties file as follow:<SID>.ISG_TEMP_DIRECTORY_LOCATION=<ISG_TEMP>
4)Run the txkISGConfigurator.xml utility with 「ebsSetup」 argument. The script will stop and restart the servers.
ant -f $JAVA_TOP/oracle/apps/fnd/txk/util/txkISGConfigurator.xml ebsSetup -DforceStop=yesjson
The following prompts appear:
•Enter the password for user APPS:
•Enter the ASADMIN user name : [ASADMIN]
•Enter the password for user ASADMIN :
•The script will forcefully stop the Oracle WebLogic Server now. Do you want to proceed (yes/no)? (yes, no)
Enter yes to stop the server. The script will stop the server and then restart the server.緩存
The above script creates and deploys the data source "OAEADatasource" on Oracle E-Business Suite WebLogic Admin server and 'oafm_cluster1' server. It also creates the Authentication Provider "IsgAuthenticator" to be used by the REST services and stops the Weblogic Admin Server after accepting a confirmation from the user.
Note that apart from ISG, the data source "OAEADatasource" is used by other Oracle E-Business Suite edge applications. You will have to size up the data source connection pool accordingly. If the data source "OAEADatasource" is already created, use the -DforceDataSourceExists=true option to replace the existing data source. To proceed the setup without re-creating or overwriting the data source, use the option -DignoreDataSourceExists=true.
Use the option -DforceAuthenticationProviderExists=true to re-create the Authentication Provider.
5.Execute adop phase=fs_clone on Oracle E-Business Suite 12.2 enabled for Online Patching to copy the REST configurations done above to the other file system
6.Add directory $FND_TOP/perl to environment variable PERL5LIB
7.Download patch 13602850 and install this patch for perl library extensions. Patch archive p13602850_R12_GENERIC.zip contains following directories
a) Class-MethodMaker-1.12 b) Compress-Raw-Zlib-2.009 c) Compress-Zlib-2.009
cd <<above listed directory>>
and perform - perl Makefile.PL | make |make install
repeat this step to install all 3 perl modules安全
使用Oracle電子商務套件集成的SOA網關腳本驗證REST服務安裝服務器
Execute the following script to validate the Oracle E-Business Suite Integrated SOA Gateway setup for REST services:
For example, use the following script to deploy a PL/SQL interface FND_USER_PKG as a REST service with POST method:
ant -f $JAVA_TOP/oracle/apps/fnd/isg/ant/isgDesigner.xml -Dactions=deploy -DserviceType=REST -DirepNames=FND_USER_PKG[{TESTUSERNAME:SYNC:POST}] -Dverbose=ON -Dalias=FndUserPkgSvcoracle
建立自定義數據庫對象(PL / SQL):app
例如:若是您將用戶標識做爲參數傳遞,如下PL / SQL程序包將返回應用程序用戶名和電子郵件地址。dom
建立一個像這樣的包規範(文件名xxfndus.pls),它應該有解析器所需的irep註釋。
set verify off
whenever sqlerror exit failure rollback;
WHENEVER OSERROR EXIT FAILURE ROLLBACK;
CREATE OR REPLACE PACKAGE XXFND_USER_QUERY AS
/* $Header: xxfndus.pls $ */
/*#
* This custom PL/SQL package can be used fetch user details.
* @rep:scope public
* @rep:product FND
* @rep:displayname User Information query
* @rep:category BUSINESS_ENTITY XXFND_USER_Q
*/
PROCEDURE main_proc(
p_user_id IN number
,v_name OUT VARCHAR2
,v_email OUT VARCHAR2
,v_msg OUT VARCHAR2
,v_status OUT VARCHAR2)
/*#
* Use this procedure to fetch user information
* @param P_USER_ID is the user_id of the user
* @param V_NAME Returns user name by the program
* @param V_EMAIL Returns user email by the program
* @param V_MSG Returns messages by the program
* @param V_STATUS Returns status of the Program
* @rep:displayname User Information query
* @rep:category BUSINESS_ENTITY XXFND_USER_Q
* @rep:scope public
* @rep:lifecycle active
*/
;
END XXFND_USER_QUERY;
/
commit;
exit;
如今建立一個像這樣的包體(文件名xxfndub.pls),包體不須要註釋。
CREATE OR REPLACE PACKAGE BODY XXFND_USER_QUERY AS
PROCEDURE main_proc
(p_user_id NUMBER
,v_name OUT VARCHAR2
,v_email OUT VARCHAR2
,v_msg OUT VARCHAR2
,v_status OUT VARCHAR2)
AS
BEGIN
SELECT USER_NAME , EMAIL_ADDRESS
INTO v_name,v_email
FROM FND_USER
WHERE user_id = p_user_id;
v_msg := 'Successfully completed';
v_status := 'S';
EXCEPTION
WHEN OTHERS THEN
v_msg := 'Completed with Error' ;
v_status := 'F';
END main_proc;
END XXFND_USER_QUERY;
/
如今編譯應用程序中的package spec&body
如今執行這個perl命令來進行irep解析
$IAS_ORACLE_HOME/perl/bin/perl $FND_TOP/bin/irep_parser.pl -g -v -username=sysadmin fnd:/patch/115/sql:xxfndus.pls:12.0=xxfndus.pls
這將生成一個名爲xxfndus_pls.ildt的ildt文件。
如今執行如下FNDLOAD命令將ildt文件上傳到IREP
$FND_TOP/bin/FNDLOAD apps/apps 0 Y UPLOAD $FND_TOP/patch/115/import/wfirep.lct xxfndus_pls.ildt
如今在SOAPUI或Chrome ARC中使用如下有效負載測試webservice
web service url: http://host.domain:port/webservices/rest/xxfnd1/main_proc/
Method: Post
Http request header parameters:
Content-Type: application/json
Accept: application/json
Authorization: Basic QVNBRE1JTjpNMGdlcm11bHVr
Content-Language: en-US
Payload Json:
{
"ISGServiceFault" : {
"Code" : "ISG_SERVICE_AUTH_FAILURE",
"Message" : "User is not authorized to execute the service",
"Resolution" : "Please check whether the user has the requisite grants.",
"ServiceDetails" : {
"ServiceName" : "xxfnd1",
"OperationName" : "main_proc",
"InstanceId" : "0"
}}}
出JSON是如下
{
"OutputParameters": {
"@xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
"@xmlns": "http://xmlns.oracle.com/apps/fnd/rest/xxfnd1/main_proc/",
"V_NAME": "SYSADMIN",
"V_EMAIL": {...},
"V_MSG": "Successfully completed",
"V_STATUS": "S"
}}
ISG REST Service Invocations中的常見錯誤有: -
策略要求身份驗證令牌
緣由:當安全頭中的Web Service安全用戶名令牌缺失或無效時,服務器將引起此錯誤。
解決方案:在安全性標頭中傳遞有效的Web服務安全用戶名令牌。
安全令牌沒法經過身份驗證或受權
緣由:當Web服務安全用戶名令牌中的用戶名或(/和)密碼無效時,服務器將引起此錯誤。
解決方案:在Web服務安全用戶名令牌中傳遞有效的Oracle應用程序用戶名和密碼。
用戶無權執行服務
緣由:Web服務安全用戶名令牌未受權執行在SOAP請求中調用的Web服務功能時,服務器將引起此錯誤。
解決方案:從Integration Repository UI在用戶,角色或全局級別建立受權,以受權用戶執行Web Service功能。從功能管理員職責清除緩存。
服務器故障:責任鍵無效
緣由:在責任關鍵字在標題中的責任標題中傳遞無效時,服務器將引起此錯誤。
解決方案:服務器但願標題中的責任標題中包含有效的責任關鍵字。
使用此查詢爲特定用戶查找有效的責任關鍵字: -
Select resp.RESPONSIBILITY_KEY, grp.SECURITY_GROUP_KEY,
APP.APPLICATION_SHORT_NAME
From FND_USER_RESP_GROUPS furg, FND_USER usr, fnd_responsibility_vl
resp,FND_SECURITY_GROUPS grp,FND_APPLICATION APP
where furg.user_id=usr.user_id
and furg.RESPONSIBILITY_ID=resp.RESPONSIBILITY_ID
and furg.SECURITY_GROUP_ID=grp.SECURITY_GROUP_ID
and furg.RESPONSIBILITY_APPLICATION_ID=APP.APPLICATION_ID
and usr.user_name= :username
責任申請短名稱無效。
緣由:服務器在報頭中的RespApplication標題中的應用短名稱無效時拋出此錯誤。
解決方案:服務器但願在Header中的RespApplication標題中使用有效的應用程序短名稱。使用上面給出的查詢來查找有效的應用程序短名稱。
安全組密鑰無效。
緣由:當標題中的安全組標題中的安全組密鑰無效時,服務器將引起此錯誤。
解決方案:服務器但願在標題中的SecurityGroup標題中使用有效的安全組密鑰。使用上面給出的查詢來查找有效的安全組密鑰。
NLS語言無效。
緣由:當標題中的NLS語言標題中的NLS語言無效時,服務器將引起此錯誤。
解決方法:服務器在標題中的NLSLanguage標題中預期有效的NLSLanguage值。使用如下查詢來查找有效的NLSLanguage:
SELECT NLS_LANGUAGE FROM FND_LANGUAGES WHERE INSTALLED_FLAG in (‘B’,’I’);
服務未部署。
緣由:當調用服務生成但未部署時,服務器會拋出此錯誤。
解決方案:從Integration Repository UI部署此服務。