【Ebs】EBS12.2.7 REST ISG的配置


一、ISG設置-基礎設置

  1. 激活ASADMIN用戶:

    a).以SYSADMIN用戶登陸EBS, 進入用戶管理職責。

    b).進入用戶菜單,搜索ASADMIN用戶。

    c).點擊更新按鈕,進入用戶更新界面。

     

    d).清空有效至字段的內容,點擊保存

     

    e).點擊重置口令按鈕,輸入新密碼,並保存,用戶狀態會變成已激活狀態。

  以上步驟在系統管理員職責下的安全>用戶FORM界面也能操作,操作方法類似

  注:完成ISG的配置之后,不要修改ASADMIN用戶密碼,否則還需要再重新配置。

  2.  分配Integration Administrator角色:

    a).點擊分配職責按鈕,在LOV搜索選擇窗口,選擇代碼,並輸入:UMX|FND_IREP_ADMIN

     

    b).勾選復選框,並點擊選擇按鈕。

    c).在證明字段隨意輸入內容,點擊應用

二、ISG REST services 的配置

  1. 配置ISG_TEMP目錄

    在EBS應用服務器上創建一個文件夾並將其作為<ISG_TEMP>,例如: 

mkdir $CUX_TOP/soa

   注:如果是多節點的話,該文件夾需要是一個共享文件夾。

   2. 修改$INST_TOP/soa/isgagent.properties文件

<SID>.ISG_TEMP_DIRECTORY_LOCATION=<ISG_TEMP>

    修改$INST_TOP/soa/文件夾下isgagent.properties的ISG_TEMP_DIRECTORY_LOCATION屬性

    同時需要新增兩個屬性來開啟ISG的log功能

<SID>.ISG_LOGGER=FILE

<SID>.ISG_GLOBAL_LOG=true

         修改以上配置之后,重啟oafm和oacore server之后產生的log文件會產生在配置的<ISG_TEMP>文件夾中。

         注多節點情況下,需要更新每個節點上的該文件

  3.執行 txkISGConfigurator.xml

    3.1 加載環境變量

source <EBS_INSTALL_BASE>/EBSapps.env RUN

      3.2 運行txkISGConfigurator.xml工具

ant -f $JAVA_TOP/oracle/apps/fnd/txk/util/txkISGConfigurator.xml ebsSetup -DforceStop=yes

     該腳本的執行過程需要提供一下信息: 

      • Enter the password for user APPS:

             輸入用戶APPS的密碼.

      • Enter the ASADMIN user name : [ASADMIN]
      • Enter the password for user ASADMIN :

             輸入用戶ASADMIN的密碼

      • The script will forcefully stop the Oracle WebLogic Server now. Do you want to proceed (yes/no)? (yes, no)

             輸入 yes 來重啟服務。

    結果顯示

          

      生成Authentication Provider

         

         

注意:

        上述腳本會創建一個“OAEADatasource”的data source,並部署至EBS的WebLogic Admin Server和'oafm_cluster1' server。同時也會創建一個REST services使用的Authentication Provider “IsgAuthenticator”,最后重啟weblogic admin server。

        如果OAEADatasource已經創建過了,上述腳本增加參數“-DforceDataSourceExists=true”來替換已有的data source。使用“ -DforceAuthenticationProviderExists=true ”來重新創建Authentication Provider。

以上步驟只要在主節點執行即可

 

可能遇到的問題

  1. 問題描述:/u01/UAT/app/fs1/EBSapps/comn/java/classes/oracle/apps/fnd/txk/util/txkISGConfigurator.xml:1756: ${patchContextFile} doesn't exist

解決方案:

參考metalink文檔Doc ID 2227168.1

原因:缺少patch context file,txkISGConfigurator.xml在執行以下查詢時只返回了一行記錄。

select *
from fnd_oam_context_files
where CTX_TYPE = 'A'
and name not in ('TEMPLATE','METADATA')
and (status is null or status !='H');

解決辦法:

在patch文件系統中運行autoconfig重新生成

a.以system用戶登錄數據庫,禁用triger :ebs_logon

alter trigger ebs_logon disable

b.切換patch文件系統

source <EBS_INSTALL_BASE>/EBSapps.env patch

c.

cd $ADMIN_SCRIPTS_HOME

d. 

./adautocfg.sh

e.啟用triger

alter trigger ebs_logon enable

f.執行查詢會出現兩行記錄

三、驗證配置-ISG REST Services

本部分主要介紹通過前台用戶界面和后台腳本的方式發布REST Webservice來驗證ISG的配置。

  3.1  前台界面驗證

    1. 以ASADMIN用戶登陸EBS,其他包含集成管理員角色的用戶也可以。
    2. 進入集成信息庫職責的集成信息庫功能,點擊搜索按鈕;
    3. 內部名稱字段輸入’FND_USER_PKG’並點擊開始按鈕來執行搜索;
    4. 點擊User鏈接,顯示接口的詳細信息;

             

      5.點擊REST Web Service 標簽頁並輸入一下內容:

        Service Alias:指明服務的別名【會顯示在服務的URI里面,因此取個比較有內涵的,例如:FndUserPkgSrv】;

      6.在Service Operations表格里面,選擇至少一個method來以REST service operation的方式暴露出來。

      7.點擊部署按鈕來部署該REST service,如果部署無誤,REST Service Status字段會顯示已部署

       

      7.點擊取消部署按鈕來取消已部署的service,Rest Service Status字段會顯示Not Deployed

 

  3.2  后台腳本驗證

    例如,我們要將一個PL/SQL類型的接口 FND_USER_PKG(並暴露TESTUSERNAME這個method) 部署為REST Service,則我們可以再應用服務器上執行下述腳本:

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=FndUserPkgSvc

     如果上述部署操作成功,即代表我們的配置無誤。

        

    界面查看該方法是否配置成功

     

四、客戶化接口—配置

  4.1  概述

    Oracle EBS ISG支持客戶化接口開發並且可以發布到Oracle Integation Repository。支持客戶化開發的接口類型有:XML Gateway Map,Business Event, PL/SQL, Concurrent Program, Business Service Object, Java APIs, Java Bean Services和BPEL Composite Service。

     

    客戶化開發ISG web service流程:

  1. 按照Integration Repository注釋標准給客戶化API添加注釋;
  2. 執行IREP Parser工具來驗證注釋好的文件,生成Integration Repository loader文件(iLDT);
  3. 上傳iLDT文件至Oracle Integration Repository;
  4. Integration Repository職責查看客戶化接口詳細信息;
  5. 為接口相關方法創建安全授權;
  6. 生成web services;
  7. 部署web services;

                             注意下圖中SOAP與REST兩種服務方式部署的不同。

  

 

  4.2  配置Integration Repository Parser(IREP Parser)

    IREP解析器是集成管理員用於按照注釋標准對客戶化接口添加的注釋驗證的獨立設計時工具,驗證完成之后生成iLDT文件,該文件被上傳到集成信息庫里,然后用於生成服務、發布服務。

    1.      安裝Perl模組

      a).通過運行EBSapps.env腳本建立運行文件系統APPL_TOP環境。

      b).定位Perl配置文件Config.pm並備份這個文件

cd $FMW_HOME/webtier/perl/lib/5.10.0/x86_64-linux-thread-multi

cp Config.pm Config.pm_bak20200320

      c).修改Config.pm文件

      <FMW_HOME>是$ FMW_HOME的絕對路徑。 

archlibexp =>relocate_inc('<FMW_HOME>/webtier/perl/lib/5.10.0/sun4-solaris-thread-multi-64')

privlibexp =>relocate_inc('<FMW_HOME>/webtier/perl/lib/5.10.0')

sitearchexp =>relocate_inc('<FMW_HOME>/webtier/perl/lib/site_perl/5.10.0/sun4-solaris-thread-multi-64')

sitelibexp =>relocate_inc('<FMW_HOME>/webtier/perl/lib/site_perl/5.10.0')

       

 

      d). 創建Perl安裝目錄

mkdir $APPL_TOP_NE/perl

chmod 755 $APPL_TOP_NE/perl

      e).在APPL_TOP環境中設置以下環境變量

export PERL5LIB=$FND_TOP/perl:$APPL_TOP_NE/perl:$PERL5LIB

export LIBPATH=$LIBPATH:$FMW_HOME/webtier/lib

export ORACLE_HOME=$FMW_HOME/webtier

LD_LIBRARY_PATH=$ORACLE_HOME/lib32:$ORACLE_HOME/lib:$LD_LIBRARY_PATH

export JAVA_HOME=/prod/EBS122/fs1/FMW_Home/jdk

      這里JAVA_HOME 可以通過運行 which java來獲取

      f).下載patch 13602850 (p13602850_R12_GENERIC.zip)並上傳、解壓

        Patch 13602850 contains the following Perl modules:

          Compress-Raw-Zlib-2.009

          Compress-Zlib-2.009

          Class-MethodMaker-1.12

        按照上面的順序安裝Perl模組

        安裝命令:   

cd $APPL_TOP_NE/perl

cp -r /temp/Compress-Raw-Zlib-2.009

cd Compress-Raw-Zlib-2.009

perl Makefile.PL

make

make install

    2. 驗證

      如果上述步驟無誤的話,執行以下腳本:

$IAS_ORACLE_HOME/perl/bin/perl $FND_TOP/bin/irep_parser.pl

                      

    若結果是如下提示則說明我們的Integration Repository Parser配置成功:

  4.3  注冊客戶化產品

  1. 創建客戶化prodcut family

    BEGIN

      -- create the custom product family

      ad_pa_insert_package.insert_ad_pm_product_info(x_product_abbreviation        => 'cux_pf'

                                                    ,x_pseudo_product_flag         => 'N'

                                                    ,x_product_family_flag         => 'Y'

                                                    ,x_application_short_name      => NULL

                                                    ,x_product_name                => 'CUX Product Family'

                                                    ,x_product_family_abbreviation => NULL

                                                    ,x_product_family_name         => NULL

                                                    ,x_aru_update_date             => to_char(SYSDATE,'YYYY-MM-DD')

                                                    ,x_currdate                    => to_char(SYSDATE,'YYYY-MM-DD')                                 ,x_last_updated_by             => -1

                                                    ,x_created_by                  => -1);

      COMMIT;

    END;

     



  1. 創建客戶化product

BEGIN

  -- create the custom product

  ad_pa_insert_package.insert_ad_pm_product_info(x_product_abbreviation        => 'cux'

                                                ,x_pseudo_product_flag         => 'N'

                                                ,x_product_family_flag         => 'N'

                                                ,x_application_short_name      => 'CUX'

                                                ,x_product_name                => 'CUX Product'

                                                ,x_product_family_abbreviation => NULL

                                                ,x_product_family_name         => NULL

                                                ,x_aru_update_date             => to_char(SYSDATE,'YYYY-MM-DD')

                                                ,x_currdate                    => to_char(SYSDATE,'YYYY-MM-DD')

                                                ,x_last_updated_by             => -1

                                                ,x_created_by                  => -1);

  COMMIT;

END;


  1. 創建family與product的聯系

    BEGIN

      -- create the relationship between family and product

      ad_pa_insert_package.insert_ad_pm_prod_family_map(x_product_abbreviation        => 'cux'

                                                       ,x_product_family_abbreviation => 'cux_pf'

                                                       ,x_aru_update_date             => to_char(SYSDATE,'YYYY-MM-DD')

                                                       ,x_currdate                    => to_char(SYSDATE,'YYYY-MM-DD')                                                   ,x_last_updated_by             => -1

                                                       ,x_created_by                  => -1);

      COMMIT;

    END;



  1. 增加客戶化BUSINESS_ENTITY:
    在LOOKUP_TYPE=BUSINESS_ENTITY中增加一個CODE:CUX_SERVICE

 

 

 

 

4.4 編寫並注釋PL/SQL接口代碼(服務端代碼)

CREATE OR REPLACE PACKAGE cux_fnd_ws_test_pkg AS

  /* $Header: cux_fnd_ws_test_pkg.pls 12.0.1 $ */

  /*#

  * This package using provide import po receive service

  * @rep:scope public

  * @rep:product cux

  * @rep:lifecycle active

  * @rep:displayname   cux_fnd_ws_test_pkg

  * @rep:compatibility S

  * @rep:category BUSINESS_ENTITY CUX_SERVICE

  */

  /*===============================================================

         Copyright (C) xxx Co., Ltd.   All Rights Reserved

  ===============================================================*/

 

  /*===================================================================

  --  Program Name  : cux_fnd_ws_test_pkg

  --  Purpose       : webservice測試包

  --  Reference     :

  --  Scope         :

  --*******************************************************************

  --  Date         Version      Author           Description

  --  2020-03-26   1.00         lingchao.sun     Initial Version

  ===================================================================*/

  --===================================================================

  --Procedure Name  : process

  --Description     : 處理流程

  --Note            :

  --Parameters      : p_id    : id 

  --                  p_name : name

  --                  p_age :age

  --                  p_birth_date :birth_date

  --                  esb_flag : ESB標識

  --                  esb_return_code : ESB返回代碼

  --                  esb_return_message : 系統返回消息

  --History         : 1.00 2020-03-26 lingchao.sun Creation

  --====================================================================

  /*#

  * process

  * @param p_id  id

  * @param p_name  name

  * @param p_age  age

  * @param p_birth_date  birth_date

  * @param esb_flag esb flag

  * @param esb_return_code esb return code

  * @param esb_return_message esb return message

  * @rep:scope public

  * @rep:lifecycle active

  * @rep:displayname process

  */

  PROCEDURE process(p_id               IN VARCHAR2,

                    p_name             IN VARCHAR2,

                    p_age              IN NUMBER,

                    p_birth_date       IN VARCHAR2,

                    esb_flag           OUT VARCHAR2,

                    esb_return_code    OUT VARCHAR2,

                    esb_return_message OUT VARCHAR2);

END cux_fnd_ws_test_pkg;    

4.5  解析、上傳

  1. 上傳cux_fnd_ws_test_pkg.pls文件至’$CUX_TOP/soa/’目錄下;
  2. 進入目錄’ $CUX_TOP/ soa/’;
  3. 運行irep_parser.pl工具來解析並驗證pls文件是否聲明正確:

命令的格式如下:

$IAS_ORACLE_HOME/perl/bin/perl $FND_TOP/bin/irep_parser.pl -g -v -username=<a fnd username> <product>:<relative path from product top>:<fileName>:<version>=<Complete File Path, if not in currect directory>

  本例中實際執行如下命令:

$IAS_ORACLE_HOME/perl/bin/perl $FND_TOP/bin/irep_parser.pl -g -v -username=sysadmin cux:patch/115/sql:cux_fnd_ws_test_pkg.pls:12.0.1=cux_fnd_ws_test_pkg.pls

結果如下(看到‘Done all files’表示驗證成功):

 

成功后,會在當前目錄下生成一個ildt文件:cux_fnd_ws_test_pkg_pls.ildt

 

  1. 上傳cux_fnd_ws_test_pkg_pls.ildt至Integration Repository;

執行upload命令上傳iLDT文件,命令格式如下

$FND_TOP/bin/FNDLOAD <APPS username>/<ORACLE Password> 0 Y UPLOAD $FND_TOP/patch/115/import/wfirep.lct <ildt file>

 

 

 UPLOAD腳本執行完成后,檢查當前目錄下的log文件,看到“Concurrent request completed successfully”表示上傳成功:

 

 

 

 

4.6  授權、部署

4.6.1        授權

創建授權即對接口中的methods的執行權限分配給某一個特定的用戶/用戶組/所有用戶,以保證服務的訪問安全性;在授權 TAB頁,勾選要創建授權的method,點擊創建授權;反之撤銷授權則是回收權限。

 

 

 

4.6.2        部署

 

l  進入REST Web 服務 TAB頁;

l  勾選需要部署的methods;

l  在服務別名處填寫服務別名;

l  點擊部署按鈕;

 

 

 

部署成功之后,REST 服務狀態變為已部署,同時出現查看WADL取消部署按鈕

 

 

 

同時服務器上<ISG_TEMP>目錄中也會生成REST文件夾

 

 

 

 

4.7  版本升級

當我們更改了包頭中的參數時,需要重新發布服務做版本升級。

需要注意的是:生成iLDT文件的IREP命令版本號要升版,同時需要清除高速緩存、重啟OAFM

l   $ADMIN_SCRIPTS_HOME/admanagedsrvctl.sh stop oafm_server1

l   $ADMIN_SCRIPTS_HOME/admanagedsrvctl.sh start oafm_server1

 

 

 

五、 客戶化接口服務-客戶端調用

  5.1  通過WADL獲取請求報文的程序包

DECLARE

  x_request     VARCHAR2(32767);

  l_url         VARCHAR2(1000);

  l_method_code VARCHAR2(100);

  l_mode_type   VARCHAR2(30);

  l_length      NUMBER;

BEGIN

  l_url         := 'http://cheng.erptest.com:8000/webservices/rest/CuxWsTestSrv?WADL';

  l_method_code := 'process';--method方法

  l_mode_type   := 'XML';--XML/JSON

  cux_fnd_isg122_utl.get_model(p_wadl_url       => l_url,

                               p_method_code    => l_method_code,

                               p_model_type     => l_mode_type,

                               x_req_model_data => x_request);

  SELECT lengthb(x_request)

    INTO l_length

    FROM dual;

  --dbms_output.put_line(l_length);

  --dbms_output.put_line(substr(x_request, 1, 500));

  --dbms_output.put_line(substr(x_request, 501, 1000));

  --dbms_output.put_line(substr(x_request, 1000, l_length));

END;           

  5.2  調用REST Service – Soap UI

    5.2.1 方式1:XML

    1. 新建WADL項目

         

      2.獲取服務的WADL,並導入WADL

      輸入請求編碼:UTF-8

      輸入方法授權的用戶名和密碼

      指定報文的格式為XML或者JSON

      輸入請求報文

       

      3.發送報文獲取相應報文

        XML類型報文

         

 

        JSON類型報文

         

    5.3  調用REST Service – PLSQL

      5.3.1 方式1:XML

       REQUEST:

DECLARE

  l_url      VARCHAR2(100) := 'http://cheng.erptest.com:8000/webservices/rest/CuxWsTestSrv/process/';

  l_request  utl_http.req;

  l_response utl_http.resp;

 

  l_req_data VARCHAR2(32767) := '<?xml version="1.0" encoding="UTF-8" ?>

<PROCESS_Input xmlns="http://xmlns.oracle.com/apps/cux/rest/CuxWsTestSrv/process/">

<RESTHeader xmlns="http://xmlns.oracle.com/apps/fnd/rest/header">

<Responsibility></Responsibility>

<RespApplication></RespApplication>

<SecurityGroup></SecurityGroup>

<NLSLanguage>SIMPLIFIED CHINESE</NLSLanguage>

<Org_Id>0</Org_Id>

</RESTHeader>

<InputParameters><P_ID>5</P_ID><P_NAME>plsql</P_NAME><P_AGE>33</P_AGE><P_BIRTH_DATE>2020-02-01</P_BIRTH_DATE></InputParameters>

</PROCESS_Input>

 ';

 

  l_resp_data         VARCHAR2(32767);

  l_http_auth_encoded VARCHAR2(100);

BEGIN

  l_request := utl_http.begin_request(l_url, 'POST', utl_http.http_version_1_1);

  utl_http.set_header(l_request,

                      'Content-Type',

                      'application/xml; charset=utf-8');

  l_http_auth_encoded := utl_raw.cast_to_varchar2(utl_encode.base64_encode(r => utl_raw.cast_to_raw('SYSADMIN:sysadmin')));

  utl_http.set_header(l_request,

                      'Authorization',

                      'Basic ' || l_http_auth_encoded);

  utl_http.set_header(l_request,

                      'Content-Length',

                      to_char(lengthb(l_req_data)));

  utl_http.write_text(l_request, l_req_data);

  l_response := utl_http.get_response(l_request);

  utl_http.read_text(l_response, l_resp_data);

  dbms_output.put_line(l_resp_data);

  utl_http.end_response(l_response);

END;

      5.3.2 方式2:JSON

REQUEST:

DECLARE

  l_url      VARCHAR2(100) := 'http://cheng.erptest.com:8000/webservices/rest/CuxWsTestSrv/process/';

  l_request  utl_http.req;

  l_response utl_http.resp;

 

  l_req_data          VARCHAR2(32767) := '{

    "PROCESS_Input": {

        "@xmlns": "http://xmlns.oracle.com/apps/cux/rest/CuxWsTestSrv/process/",

        "RESTHeader": {

            "@xmlns": "http://xmlns.oracle.com/apps/fnd/rest/header",

            "Responsibility": "",

            "RespApplication": "",

            "SecurityGroup": "",

            "NLSLanguage": "SIMPLIFIED CHINESE",

            "Org_Id": "0"

        },

        "InputParameters": {"P_ID":"5","P_NAME":"json","P_AGE":"22","P_BIRTH_DATE":"2020-01-02"

        }

    }

}';

  l_resp_data         VARCHAR2(32767);

  l_http_auth_encoded VARCHAR2(100);

BEGIN

  l_request := utl_http.begin_request(l_url, 'POST', utl_http.http_version_1_1);

  utl_http.set_header(l_request,

                      'Content-Type',

                      'application/json; charset=utf-8');

  l_http_auth_encoded := utl_raw.cast_to_varchar2(utl_encode.base64_encode(r => utl_raw.cast_to_raw('SYSADMIN:sysadmin')));

  utl_http.set_header(l_request,

                      'Authorization',

                      'Basic ' || l_http_auth_encoded);

  utl_http.set_header(l_request,

                      'Content-Length',

                      to_char(lengthb(l_req_data)));

  utl_http.write_text(l_request, l_req_data);

  l_response := utl_http.get_response(l_request);

  utl_http.read_text(l_response, l_resp_data);

  dbms_output.put_line(l_resp_data);

  utl_http.end_response(l_response);

END;


          

5.4  分析webservice調用報錯的方法

cd $EBS_DOMAIN_HOME/servers/oafm_server1/logs

tail -f oafm_server1.out

然后調用服務,看日志的內容。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM