機械翻訳について

拡張ルールの外部データの取得

拡張ルールを使用して、Oracle Fusion Applicationsの外部にあるwebサービスをコールできます。

たとえば、サプライヤから製品仕様に関するデータを取得したり、政府規制の大規模なセットからデータを取得したりするなど、webサービスをモデルに保持するのではなく、Webサービスからデータを取得する方が効率的です。

設定のサマリー

  1. webサービスを接続します。
  2. 拡張ルールを作成します。

Webサービスの接続

  1. 管理者権限でOracle Applicationsにサインインします。
  2. 「設定および保守」作業領域に移動し、「タスク」>「検索」をクリックします。
  3. 「拡張の外部サービス詳細の管理」タスクを検索して開きます。
  4. 「コネクタ詳細の管理」ページで、「処理」>「行の追加」をクリックし、値を設定します。

    属性 説明
    ターゲット・システム

    データを提供するアプリケーションを選択します。

    取引先コミュニティ・パートナとして登録したアプリケーションを選択するか、Oracleアプリケーションを選択できます。

    コネクタ名

    拡張ルールからサービスを参照するために使用する名前を入力します。

    この例では、VisionCorpと入力します。

    コネクタURL

    外部webサービスのURLを入力します。

    たとえば、http://visioncorp04.com:7011/services/VisionWebServicePortと入力します。

    ユーザー名 呼び出すサービスにユーザー名が必要な場合は、それを入力します。
    パスワード 呼び出すサービスにパスワードが必要な場合は、それを入力します。
    起動モード 「同期」を選択します。
  5. 「保存してクローズ」をクリックします。

拡張ルールの作成

すでにGroovyスクリプトを作成し、そのスクリプトでwebサービスをコールする必要があるとします。

  1. Oracle Configuratorの管理に必要な権限でOracle Applicationsにサインインします。
  2. 「コンフィギュレータ・モデル」作業領域に移動します。
  3. スクリプトを含むモデルを開きます。
  4. 「コンフィギュレータ・モデルの編集」ページで、「ルール」をクリックし、拡張ルールを編集のために開きます。
  5. 「構造」領域で、モデルのルート・ノードなど、「ベース・ノード」を選択します。
  6. 「ルール・テキスト」領域に、webサービスを呼び出すGroovyスクリプトを入力します。
    import oracle.apps.scm.configurator.runtime.core.IRuntimeNode; 
    import oracle.apps.scm.configurator.runtime.core.ServiceException; 
    import oracle.apps.scm.configurator.runtime.core.SoapServiceRequest; 
    import oracle.apps.scm.configurator.runtime.core.SoapServiceRequest.SOAP_PROTOCOL_TYPE; 
    import oracle.apps.scm.configurator.runtime.core.SoapServiceResponse; 
    import javax.xml.soap.SOAPBody; 
    import javax.xml.soap.SOAPMessage; 
    import javax.xml.soap.SOAPElement; 
    import javax.xml.soap.SOAPBodyElement; 
    import javax.xml.namespace.QName; 
    import org.w3c.dom.Document; 
    import org.w3c.dom.Element; 
    
    public class WebCXmin implements Serializable { 
       public WebCXmin() { } 
       
       public String callWebService(IRuntimeNode node) { 
         SoapServiceRequest request = new SoapServiceRequest(node.getConfiguration()); 
         SOAPMessage message  = request.getSoapMessage(); 
    
         // Create the XML payload.
         QName bodyName = new QName("ws", "executeWebCX"); 
         SOAPBodyElement bodyElement = request.getSoapBody().addBodyElement(bodyName); 
         bodyElement.addNamespaceDeclaration("ws", "http://services.vision/"); 
         bodyElement.setPrefix("ws");   
         
         QName className = new QName("className"); 
         SOAPElement classes = bodyElement.addChildElement(className);     
         classes.addTextNode("axel.ce.ws.webcx.DSPrimeTestCX"); 
         
         QName name = new QName("params"); 
         SOAPElement params = bodyElement.addChildElement(name); 
         
         QName entry = new QName("entry"); 
         SOAPElement entries = params.addChildElement(entry);     
         
         QName key = new QName("key"); 
         SOAPElement keys = entries.addChildElement(key);   
         keys.addTextNode("json"); 
         
         QName value = new QName("value"); 
         SOAPElement values = entries.addChildElement(value);   
         values.addTextNode("{\"qty\": 2, \"children\": [], \"type\": \"MI\", \"state\": [\"UTRU\", \"SELD\", \"USLD\"]}");     
         
         message.getMimeHeaders().addHeader("Content-Type", "text/xml; charset=utf-8"); 
         message.getMimeHeaders().addHeader("SOAPAction", "executeWebCX");     
         SoapServiceResponse response; 
         try { 
         // Call the web service that you specified in the Setup and Maintenance work area.
            response = node.getConfiguration().invokeSoapService("VisionWS", request); 
         } catch (ServiceException e1) { 
            throw new Exception(" msg=" + e1.getMessage()); 
         } 
         def base = node; 
         def tf = base.getChildByName("TextFeature");         
         Document doc = response.getSoapBody().extractContentAsDocument(); 
         Element root = doc.getDocumentElement();           
         tf.textValue = "SOAP Body node: "+root.getFirstChild().getTextContent(); 
      } 
    }   
    
  7. イベントをバインドします。
    属性

    イベント

    次の中から1つを選択します。

    • postConfigInit ランタイム構成が開始されると、webサービスをコールします。
    • postValueChange バインドが参照するノード上でユーザーが値を変更したときに、webサービスをコールします。
    Class ScriptClass
    メソッド

    getCpuHw(String region)

    webサービスがregion引数の値を解釈できることを確認します。

ガイドライン

  • スクリプトは、SoapServiceResponseクラスとSoapServiceRequestクラスをインポートする必要があります。 必要に応じて、他のクラスをインポートする必要がある場合があります。
  • この例では、webサービスのhttp://services.visionネームスペースとcpuHwメソッドを使用します。 これは、webサービスで定義されていることを前提としています。
  • webサービスをコールするには、構成オブジェクトのinvokeSoapServiceメソッドを使用し、ペイロードに登録するコネクタ名に送信する必要があります。 この例では、コネクタ名はVisionWSです。

SOAP 1.1またはSOAP 1.2の呼出し

SOAPサービスをコールするには、SOAP 1.1仕様を使用する必要があります。 SOAP 1.2はWebサービス定義言語(WSDL)をサポートしていないため、SOAP 1.2はこれらとともに使用できません。 回避策として、拡張ルールでwebサービスをコールするときにHTTPヘッダーを追加できます:

Content-Type: text/xml
SOAPAction: executeWebCX

たとえば:

SOAPMessage message  = request.getSoapMessage(); 
message.getMimeHeaders().addHeader("Content-Type", "text/xml; charset=utf-8"); 
message.getMimeHeaders().addHeader("SOAPAction", "executeWebCX");

これらのHTTPヘッダーを指定しない場合、SOAP 1.1コールは失敗します。