Microsoft Dynamics GP Connector - Mule 4

Microsoft Dynamics GP Connector v2.1

Microsoft Dynamics GP 用 Anypoint Connector を使用して、Mule アプリケーションは Microsoft Dynamics Great Plains (GP) Web サービスとやりとりすることができます。

始める前に

この情報を使用するには、Microsoft Dynamics GP、Mule Runtime Engine (Mule)、Anypoint Connector、Anypoint Studio、Mule の概念、Mule フローの要素、グローバル要素に精通している必要があります。

このコネクタを使用するには次が必要です。

  • Microsoft Dynamics GP インスタンス。

  • Kerberos 接続に使用する有効なログイン情報。

  • MuleSoft Enterprise ライセンス。

POM ファイル情報

<dependency>
  <groupId>com.mulesoft.connectors</groupId>
  <artifactId>mule-microsoft-dynamics-gp-connector</artifactId>
  <version>x.x.x</version>
  <classifier>mule-plugin</classifier>
</dependency>

x.x.x​ を使用しているコネクタに対応するバージョンに置き換えます。

最新の ​pom.xml​ ファイル情報を取得するには、​ Anypoint Exchange​ でコネクタにアクセスし、​[Dependency Snippets (連動関係スニペット)]​ をクリックします。

互換性

アプリケーション/サービス バージョン

Mule Runtime

EE 4.1.0 以降

Anypoint Studio

7.1 以降

Java

JDK 8

Design Center での接続

  1. Design Center で、HTTP リスナーやスケジューラーなどのトリガーをクリックします。

  2. コネクタの HTTP グローバル要素を作成するには、Mule アプリケーションがリスンするパスを設定します。

    パスを設定
  3. [Edit (編集)] をクリックし、次の項目を設定します。

    トリガーオプション
    項目 説明

    プロトコル

    HTTP エンドポイントのプロトコル。HTTP または HTTPS (セキュア) を選択できます。

    Host (ホスト)

    Mule アプリケーションが要求をリスンする IP アドレス。

    Port (ポート)

    Mule アプリケーションが要求をリスンするポートアドレス。

    Base Path (ベースパス)

    省略可能なベースパス。Mule アプリケーションは、ベースパス + パスをリスンします。

  4. トリガーの横にあるプラス記号を選択してコンポーネントを追加します。

  5. コンポーネントとしてコネクタを選択します。

  6. 操作を選択します。

    操作
  7. コネクタのグローバル要素を設定します。

    コネクタの設定
    項目 説明

    Username (ユーザー名)

    https://msdn.microsoft.com/en-us/library/windows/desktop/aa380525(v=vs.85).aspx​ - 認証する Dynamics GP ユーザーのユーザープリンシパル名。

    Password (パスワード)

    Dynamics GP に接続するユーザーのパスワード。

    Endpoint URL (エンドポイント URL)

    SOAP サービスが公開されるベース URL。形式は次のとおりです。​http://<Server>:<WebServicePort>/Dynamics/GPService/GPService

    SPN

    サービスインスタンスを識別するサービスプリンシパル名。

    Login Conf. Location (ログイン設定の場所)

    Kerberos ログインモジュールへのパス。

    Krb5 Conf. Location (Krb5 設定の場所)

    Kerberos 設定ファイルへのパス。

サンプルの Kerberos 設定ファイル:

[libdefaults]
default_realm = MYREALM.COM

[realms]
MYREALM.COM = {
 kdc = mydomaincontroller.myrealm.com
 default_domain = MYREALM.COM
}

[domain_realm]
.myrealm.com = MYREALM.COM
myrealm.com = MYREALM.COM

注意:​ realm と default_domain は大文字と小文字が区別されます。Active Directory で定義されたとおりに正確に指定する必要があります。テスト接続中に受信する「Message stream modified (41) (メッセージストリームが変更されました (41))」というエラーは、ドメイン名の形式が正しくないことを示しています。

Kerberos 設定ファイルの作成方法についての詳細は、 『MIT Kerberos Documentation (MIT Kerberos ドキュメント)』の「krb5.conf」​を参照してください。

Kerberos ログインモジュール (Krb5LoginModule) は、シナリオ固有の設定を使用し、JAAS ログイン設定ファイルを定義して調整できます。以下は、Kerberos ログインモジュールの JAAS ログイン設定ファイルのサンプルです。

Kerberos {
    com.sun.security.auth.module.Krb5LoginModule required
    debug=true
    refreshKrb5Config=true;
};

Kerberos ログインモジュールの JAAS ログイン設定ファイルの作成方法についての詳細は、 Java ドキュメント『Class Krb5LoginModule (クラス Krb5LoginModule)』​を参照してください。

Studio プロジェクトへのコネクタの追加

Anypoint Studio には、Studio プロジェクトにコネクタを追加する 2 つの方法があります。Studio タスクバーの Exchange ボタンから追加するか、[Mule Palette (Mule パレット)] ビューから追加します。

Exchange を使用してコネクタを追加する

  1. Studio で Mule プロジェクトを作成します。

  2. Studio タスクバーの左上にある Exchange アイコン ​(X)​ をクリックします。

  3. Exchange で、​[Login (ログイン)]​ をクリックし、Anypoint Platform のユーザー名とパスワードを指定します。

  4. Exchange で、「gp」を検索します。

  5. コネクタを選択して ​[Add to project (プロジェクトに追加)]​ をクリックします。

  6. 画面の指示に従ってコネクタをインストールします。

Studio でコネクタに追加する

  1. Studio で Mule プロジェクトを作成します。

  2. [Mule Palette (Mule パレット)] ビューで、​[(X) Search in Exchange ((X) Exchange 内を検索)]​ をクリックします。

  3. [Add Modules to Project (モジュールをプロジェクトに追加)]​ で、検索項目に「gp」と入力します。

  4. [Available modules (使用可能なモジュール)]​ で、このコネクタの名前をクリックします。

  5. [Add (追加)]​ をクリックします。

  6. [Finish (完了)]​ をクリックします。

Studio で設定する

  1. コネクタ操作を Studio キャンバスにドラッグします (Design Center の場合と同じです)。

  2. コネクタのグローバル要素を設定します (Design Center の場合と同様)。

    Anypoint 設定

ユースケース: Studio

顧客の作成

顧客の作成ユースケースのフロー
  1. [Mule Palette (Mule パレット)] から、[HTTP Listener (HTTP リスナー)] 要素をキャンバスにドラッグし、デフォルトの設定を使用しますが、パスは /createCustomer に設定します。

  2. [HTTP Listener (HTTP リスナー)] 要素の横に [Transform Message (メッセージを変換)] 要素をドラッグし、以下を追加します。

    %dw 2.0
    output application/xml
    ns ns0 http://schemas.microsoft.com/dynamics/gp/2010/01
    ns ns01 http://schemas.datacontract.org/2004/07/Microsoft.Dynamics.Common
    ns ns02 http://schemas.datacontract.org/2004/07/Microsoft.Dynamics.GP
    ns xsi http://www.w3.org/2001/XMLSchema-instance
    ---
    {
    	ns0#CreateCustomer: {
    		ns0#customer: {
    			ns02#Key: {
    				ns02#Id: attributes.queryParams.customerKeyID
    			},
    			ns02#Name: attributes.queryParams.customerName
    		},
    		ns0#context: {
    			ns01#OrganizationKey @(xsi#"type": "ns01:CompanyKey") : {
    				ns01#Id: attributes.queryParams.companyKeyID
    			}
    		}
    	}
    }
  3. [Transform Message (メッセージを変換)] 要素の横に Microsoft Dynamics GP Connector をドラッグします。

  4. 設定を行い、必須項目を入力します。これは、フローにドラッグされる他の Dynamics GP Connector にも当てはまります。

  5. [Create Entity (エンティティを作成)] 操作を選択します。ドロップダウンリストから [Customer (顧客)] エンティティを選択します。[Input Reference (入力参照)] はそのままにします。

  6. コネクタの横に [Set Payload (ペイロードを設定)] 要素をドラッグし、値を ​Success​ に設定します。

顧客の取得

顧客の取得ユースケースのフロー
  1. [Mule Palette (Mule パレット)] から、[HTTP Listener (HTTP リスナー)] 要素をキャンバスにドラッグし、デフォルトの設定を使用しますが、パスは /getCustomer に設定します。

  2. [HTTP Listener (HTTP リスナー)] 要素の横に [Transform Message (メッセージを変換)] 要素をドラッグし、以下を追加します。

    %dw 2.0
    output application/xml
    ns ns0 http://schemas.microsoft.com/dynamics/gp/2010/01
    ns ns01 http://schemas.datacontract.org/2004/07/Microsoft.Dynamics.GP
    ns ns02 http://schemas.datacontract.org/2004/07/Microsoft.Dynamics.Common
    ns xsi http://www.w3.org/2001/XMLSchema-instance
    ---
    {
    	ns0#GetCustomerByKey: {
    		ns0#key: {
    			ns01#Id: attributes.queryParams.customerKeyID
    		},
    		ns0#context: {
    			ns02#OrganizationKey @(xsi#"type": "ns02:CompanyKey") : {
    				ns02#Id: attributes.queryParams.companyKeyID
    			}
    		}
    	}
    }
  3. [Transform Message (メッセージを変換)] 要素の横に Microsoft Dynamics GP Connector をドラッグします。

  4. [Get Entity By Key (キーでエンティティを取得)] 操作を選択します。ドロップダウンリストから [Customer (顧客)] エンティティを選択します。[Input Reference (入力参照)] はそのままにします。

  5. コネクタの横に [Transform Message (メッセージを変換)] 要素をドラッグし、以下を追加します。

    %dw 2.0
    output application/json
    ---
    payload

顧客の更新

顧客の更新ユースケースのフロー
  1. [Mule Palette (Mule パレット)] から、[HTTP Listener (HTTP リスナー)] 要素をキャンバスにドラッグし、デフォルトの設定を使用しますが、パスは /updateCustomer に設定します。

  2. [HTTP Listener (HTTP リスナー)] 要素の横に [Transform Message (メッセージを変換)] 要素をドラッグし、以下を追加します。

    %dw 2.0
    output application/xml
    ns ns0 http://schemas.microsoft.com/dynamics/gp/2010/01
    ns ns01 http://schemas.datacontract.org/2004/07/Microsoft.Dynamics.Common
    ns ns02 http://schemas.datacontract.org/2004/07/Microsoft.Dynamics.GP
    ns xsi http://www.w3.org/2001/XMLSchema-instance
    ---
    {
    	ns0#GetCustomerByKey: {
    		ns0#key: {
    			ns02#Id: attributes.queryParams.keyId
    		},
    		ns0#context: {
    			ns01#OrganizationKey @(xsi#"type": "ns01:CompanyKey") : {
    				ns01#Id: attributes.queryParams.companyKeyID
    			}
    		}
    	}
    }
  3. この [Transform Message (メッセージを変換)] に「updatedComment」という変数を作成し、次の値を設定します。

    %dw 2.0
    output application/java
    ---
    {
    	comment1: payload.customer.comment1
    }
  4. [Transform Message (メッセージを変換)] 要素の横に Microsoft Dynamics GP Connector をドラッグします。

  5. [Get Entity By Key (キーでエンティティを取得)] 操作を選択します。ドロップダウンリストから [Customer (顧客)] エンティティを選択します。[Input Reference (入力参照)] はそのままにします。

  6. コネクタの横に [Transform Message (メッセージを変換)] 要素をドラッグし、以下を追加します。

    %dw 2.0
    output application/java
    ---
    %dw 2.0
    output application/xml
    ns ns0 http://schemas.microsoft.com/dynamics/gp/2010/01
    ns ns01 http://schemas.datacontract.org/2004/07/Microsoft.Dynamics.Common
    ns ns02 http://schemas.datacontract.org/2004/07/Microsoft.Dynamics.GP
    ns xsi http://www.w3.org/2001/XMLSchema-instance
    ---
    {
    	ns0#UpdateCustomer: {
    		ns0#customer: {
    			ns02#Comment1: vars.comment1,
    			ns02#Key: {
    				ns02#Id: payload.key.id
    			},
    			ns02#Name: payload.name
    		},
    		ns0#context: {
    			ns01#OrganizationKey @(xsi#"type": "ns01:CompanyKey") : {
    				ns01#Id: attributes.queryParams.companyKeyID
    			}
    		}
    	}
    }
  7. [Transform Message (メッセージを変換)] 要素の横に Microsoft Dynamics GP Connector をドラッグします。

  8. [Update Entity (エンティティを更新)] 操作を選択します。ドロップダウンリストから [Customer (顧客)] エンティティを選択します。[Input Reference (入力参照)] はそのままにします。

  9. コネクタの横に [Set Payload (ペイロードを設定)] 要素をドラッグし、値を ​Success​ に設定します。

顧客の削除

顧客の削除ユースケースのフロー
  1. [Mule Palette (Mule パレット)] から、[HTTP Listener (HTTP リスナー)] 要素をキャンバスにドラッグし、デフォルトの設定を使用しますが、パスは /deleteCustomer に設定します。

  2. [HTTP Listener (HTTP リスナー)] 要素の横に [Transform Message (メッセージを変換)] 要素をドラッグし、以下を追加します。

    %dw 2.0
    output application/xml
    ns ns0 http://schemas.microsoft.com/dynamics/gp/2010/01
    ns ns01 http://schemas.datacontract.org/2004/07/Microsoft.Dynamics.GP
    ns ns02 http://schemas.datacontract.org/2004/07/Microsoft.Dynamics.Common
    ns xsi http://www.w3.org/2001/XMLSchema-instance
    ---
    {
    	ns0#DeleteCustomer: {
    		ns0#key: {
    			ns01#Id: attributes.queryParams.customerKeyID
    		},
    		ns0#context: {
    			ns02#OrganizationKey @(xsi#"type": "ns02:CompanyKey") : {
    				ns02#Id: attributes.queryParams.companyKeyID
    			}
    		}
    	}
    }
  3. [Transform Message (メッセージを変換)] 要素の横に Microsoft Dynamics GP Connector をドラッグします。

  4. [Delete Entity (エンティティを削除)] を選択します。ドロップダウンリストから [Customer (顧客)] エンティティを選択します。[Input Reference (入力参照)] はそのままにします。

  5. コネクタの横に [Set Payload (ペイロードを設定)] 要素をドラッグし、値を ​Success​ に設定します。

顧客リストの取得

顧客リストの取得ユースケースのフロー
  1. [Mule Palette (Mule パレット)] から、[HTTP Listener (HTTP リスナー)] 要素をキャンバスにドラッグし、デフォルトの設定を使用しますが、パスは /getCustomerList に設定します。

  2. [HTTP Listener (HTTP リスナー)] 要素の横に [Transform Message (メッセージを変換)] 要素をドラッグし、以下を追加します。

    %dw 2.0
    output application/xml
    ns ns0 http://schemas.microsoft.com/dynamics/gp/2010/01
    ns ns01 http://schemas.datacontract.org/2004/07/Microsoft.Dynamics.Common
    ns ns02 http://schemas.datacontract.org/2004/07/Microsoft.Dynamics.GP
    ns xsi http://www.w3.org/2001/XMLSchema-instance
    ---
    {
    	ns0#GetCustomerList: {
    		ns0#criteria: {
    			ns02#Name: {
    				ns01#Like: attributes.queryParams.like
    			}
    		},
    		ns0#context: {
    			ns01#OrganizationKey @(xsi#"type": "ns01:CompanyKey") : {
    				ns01#Id: attributes.queryParams.companyKeyID
    			}
    		}
    	}
    }
  3. [Transform Message (メッセージを変換)] 要素の横に Microsoft Dynamics GP Connector をドラッグします。

  4. [Get Entity List (エンティティリストを取得)] を選択します。ドロップダウンリストから [Customer (顧客)] エンティティを選択します。[Input Reference (入力参照)] はそのままにします。

  5. コネクタの横に [Transform Message (メッセージを変換)] 要素をドラッグし、以下を追加します。

    %dw 2.0
    output application/json
    ---
    payload