---
schema_version: "1"
id: 7a61b6e3c59f6fbf3beda89e34897e6ee6e8e2791bdf393bbae34271116bc483
title: Workday Connector 14.0 の例 - Mule 4
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/workday-connector/14.0/workday-connector-examples.md
canonical_url: https://docs.mulesoft.com/jp/workday-connector/14.0/workday-connector-examples
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 26119cef1b500ee3cac6a9eebe9e893ff347aaad29fcaada6f1ddd18e255cb6f
description: MuleSoft Documentation Site
release: "14.0"
latest: false
---
# Workday Connector 14.0 の例 - Mule 4

Workday 用 Anypoint Connector (Workday Connector) には 2 つの財務管理サービスの例が提供されており、Anypoint Studio と Anypoint Design Center の Flow Designer を使用して Workday Connector を設定する方法を見ることができます。

- [​財務管理サービスに資金を追加する](#add-fund)​
- [​位置要求を作成する](#create-position-request)

## [](#前提条件)前提条件

以下が必要です。

- Workday へのアクセス
- Workday のユーザー名、パスワード、テナント名

## [](#add-fund)Workday 財務管理サービスに資金を追加する (Studio の例)

この例では、​**Invoke**​ 操作を使用して、資金を Workday 財務管理サービスに挿入します。

## [](#http-リスナーを設定する)HTTP リスナーを設定する

ローカルホストポート 8081 で ​`/`​ アカウントパスへのコールが行われたときに Mule フローを開始するように ​**HTTP リスナー**​を設定します。

この例では一部の項目値に変数を使用しています。次のいずれかを実行できます。

- コード内で変数を値に置き換える。
- プロパティファイルで各変数の値を指定しておき、コネクタ設定からそのファイルを参照する。

プロパティファイルの使い方が分からない場合は、​[「Configuring Property Placeholders (プロパティプレースホルダーの設定)」](https://docs.mulesoft.com/mule-runtime/latest/mule-app-properties-to-configure)​を参照してください。

**HTTP リスナー**​を設定するには、次の手順に従います。

1. Studio で新しい Mule プロジェクトを作成します。
2. **\[Mule Palette (Mule パレット)\]**​ ビューで「​`http`​」を検索し、​**\[Listener\]**​ 操作を選択します。
    
    \[Mule Palette (Mule パレット)\] ビューで Listener 操作を選択します。
    
    ![Listener 操作の選択](/mulesoft/current/ja-jp/workday-connector/14.0/_images/workday-select-listener.png)
3. **Listener**​ 操作をキャンバスにドラッグします。
4. **Listener**​ 設定で、​**\[Connector configuration (コネクタ設定)\]**​ 項目の横にある ​**\[+\]**​ をクリックしてグローバル要素を追加します。
5. **\[OK\]**​ をクリックして、デフォルトを受け入れます。
6. **\[Path (パス)\]**​ 項目を ​`/`​ に設定します。
    
    ![Listener 設定](/mulesoft/current/ja-jp/workday-connector/14.0/_images/workday-http-props.png)
    
    Figure 1. Listener 設定で \[Path (パス)\] 項目を設定します。

### [](#transform-message-コンポーネントを追加してメタデータを添付する)Transform Message コンポーネントを追加してメタデータを添付する

**Transform Message**​ コンポーネントを追加および設定する手順は、次のとおりです。

1. **\[Mule Palette (Mule パレット)\]**​ ビューで、​`transform`​ を検索して ​**\[Transform Message\]**​ を選択します。
    
    ![\[Transform Message\] コンポーネントの選択](_images/workday-select-transform.png)
    
    Figure 2. \[Mule Palette (Mule パレット)\] ビューで \[Transform Message\] を選択します。
2. **Transform Message**​ コンポーネントをキャンバスの ​**Listener**​ コンポーネントの右にドラッグします。
3. **Transform Message**​ 設定で、​**\[Output (出力)\]**​ セクションの括弧を次の XML で上書きします。
    
    ```dataweave
    %dw 2.0
    output application/xml
    ns ns0 urn:com.workday/bsvc
    ---
    {
      ns0#Put_Fund_Request @(ns0#Add_Only: true, ns0#version: "v36.0"): {
        ns0#Fund_Data: {
          ns0#Fund_Name: "I.M.F",
          ns0#Fund_Type_Reference: {
            ns0#ID @(ns0#'type': 'Fund_Type_ID'): "FUND_TYPE-6-3"
          }
        }
      }
    }
    ```

次の XML は、​**Transform Message**​ コンポーネントの入力例を示しています。

```xml
<ns0:Put_Fund_Request xmlns:ns0="urn:com.workday/bsvc" Add_Only="true" version="v36.0">
  <ns0:Fund_Data>
    <ns0:Fund_Name>I.M.F</ns0:Fund_Name>
    <ns0:Fund_Type_Reference>
      <ns0:ID type="Fund_Type_ID">FUND_TYPE-6-3</ns0:ID>
    </ns0:Fund_Type_Reference>
  </ns0:Fund_Data>
</ns0:Put_Fund_Request>
```

次のスクリーンショットは、​**Transform Message**​ 設定の ​**\[Output (出力)\]**​ セクションに表示される出力を示しています。

![Transform Message の出力](/mulesoft/current/ja-jp/workday-connector/14.0/_images/workday-transform-message.png)

Figure 3. Transform Message 設定の出力

## [](#財務管理操作を追加および設定する)財務管理操作を追加および設定する

1. **\[Mule Palette (Mule パレット)\]**​ ビューで ​`workday`​ を検索し、​**\[Financial management\]**​ 操作を選択します。
2. **Financial management**​ 操作をキャンバスの ​**Transform Message**​ コンポーネントの右にドラッグします。
3. **Financial management**​ 設定で、​**\[Connector configuration (コネクタ設定)\]**​ 項目の横にある ​**\[+\]**​ をクリックしてグローバル要素を追加します。
4. 次のようにグローバル要素を設定します。
    
    - **Configuration Name (設定名)**​: `My_Workday_Connection`​
    - **Connection (接続)**​: `Basic authentication api`​
    - **Password (パスワード)**​: `${workday.password}`​
    - **Host Name (ホスト名)**​: デフォルトのまま​`impl-cc.workday.com`​
    - **Tenant Name (テナント名)**​: `${workday.tenantName}`​
    - **Username (ユーザー名)**​: `${workday.userName}`​
5. **\[Test Connection (テスト接続)\]**​ をクリックして、でユーザー名、パスワード、テナント名が正しいことを確認します。
6. **\[OK\]**​ をクリックします。
7. プロパティウィンドウの ​**\[Operation (操作)\]**​ 項目で ​`Put_Fund`​ を選択します。

### [](#mule-コンソールに応答を出力するロガーを追加する)Mule コンソールに応答を出力するロガーを追加する

1. **\[Mule Palette (Mule パレット)\]**​ ビューで、​`logger`​ を検索して ​**\[Logger (Core) (Logger (コア))\]**​ を選択します。
2. **Logger**​ コンポーネントを、キャンバスの ​**\[Financial management\]**​ コンポーネントの右にドラッグします。
3. 次の項目を設定します。
    
    <table class="tableblock frame-all grid-all fit-content spread">
<colgroup>
<col>
<col>
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">項目</th>
<th class="tableblock halign-left valign-top">値</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Display Name (表示名)</strong></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">「​<code>Log Response</code>​」と入力します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Message (メッセージ)</strong></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">「​<code>`​#[payload]​`</code>​」と入力します。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><strong>Level (レベル)</strong></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">デフォルト (​<code>INFO</code>​) のままにします。</p></td>
</tr>
</tbody>
</table>
4. プロジェクトを保存します。
5. ポート 8081 で ​`/`​ に要求を送信してアプリケーションをテストします。
6. 次のような XML 応答を受信します。

```xml
<wd:Put_Fund_Response xmlns:wd="urn:com.workday/bsvc" wd:version="v36.0">
    <wd:Fund_Reference wd:Descriptor="I.M.F">
        <wd:ID wd:type="WID">THE_WID_ID_NUMBER</wd:ID>
        <wd:ID wd:type="Fund_ID">FUND-6-399</wd:ID>
    </wd:Fund_Reference>
</wd:Put_Fund_Response>
```

## [](#財務管理例の-xml)財務管理例の XML

この例のフローをすばやく Mule アプリケーションに読み込むには、次のコードを Studio XML エディターに貼り付けます。

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

<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:http="http://www.mulesoft.org/schema/mule/http"
	xmlns:workday="http://www.mulesoft.org/schema/mule/workday"
	xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/workday http://www.mulesoft.org/schema/mule/workday/current/mule-workday.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
	<http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" >
		<http:listener-connection host="0.0.0.0" port="8081" />
	</http:listener-config>
	<workday:config name="My_Workday_Connection" doc:name="Workday Config" >
		<workday:basic-authentication-api-connection password="${workday.password}" tenantName="${workday.tenantName}" userName="${workday.userName}" />
	</workday:config>
	<http:listener-config name="HTTP_Listener_config1" doc:name="HTTP Listener config" >
		<http:listener-connection host="0.0.0.0" port="8081" />
	</http:listener-config>
	<workday:config name="My_Workday-Connection" doc:name="Workday Config" >
		<workday:basic-authentication-api-connection password="${workday.password}" tenantName="${workday.tenantName}" userName="${workday.userName}" />
	</workday:config>
	<flow name="workday-13-test-exampleFlow" >
		<http:listener doc:name="Listener" config-ref="HTTP_Listener_config1" path="/"/>
		<ee:transform doc:name="Transform Message" >
			<ee:message >
				<ee:set-payload ><![CDATA[%dw 2.0
output application/xml
ns ns0 urn:com.workday/bsvc
---
{
  ns0#Put_Fund_Request @(ns0#Add_Only: true, ns0#version: "v36.0"): {
    ns0#Fund_Data: {
      ns0#Fund_Name: "I.M.F",
      ns0#Fund_Type_Reference: {
        ns0#ID @(ns0#'type': 'Fund_Type_ID'): "FUND_TYPE-6-3"
      }
    }
  }
}]]></ee:set-payload>
			</ee:message>
		</ee:transform>
		<workday:financial-management doc:name="Financial management" config-ref="My_Workday-Connection"/>
		<logger level="INFO" doc:name="Log Response"  message="#[payload]"/>
	</flow>
</mule>
```

## [](#create-position-request)Workday 位置要求を作成する (Flow Designer の例)

財務位置では、組織の資産、負債、株式の現在の残高が示されます。 この例では、Workday 位置要求を作成します。

1. Flow Designer で Mule アプリケーションを作成します。
2. HTTP リスナーをフローのトリガーとして追加して設定します。
3. **\[Path (パス)\]**​ 項目を ​`/create_position`​ に設定し、HTTP リスナーの接続にデフォルトの設定を使用します。
4. Dataweave コンポーネントである ​**Transform**​ をフローに追加します。
5. この変換スクリプトを DataWeave に提供します。
    
    ```dataweave
    %dw 2.0
    
    ns ns0 urn:com.workday/bsvc
    
    
    output application/xml
    ---
    {
      ns0#Create_Position_Request: {
        ns0#Business_Process_Parameters: {
          ns0#Auto_Complete: true,
          ns0#Run_Now: true
        },
        ns0#Create_Position_Data: {
          ns0#Supervisory_Organization_Reference: {
            ns0#ID @("ns0:type": "Organization_Reference_ID"): "SUPERVISORY_ORGANIZATION-6-226"
          },
          ns0#Position_Data: {
            ns0#Job_Posting_Title: "General Manager"
          },
          ns0#Position_Group_Restrictions_Data: {
            ns0#Availability_Date: "2019-07-06",
            ns0#Earliest_Hire_Date: "2019-07-08"
          },
          ns0#Edit_Assign_Organization_Sub_Process: {
            ns0#Business_Sub_Process_Parameters: {
              ns0#Skip: true
            }
          },
          ns0#Request_Default_Compensation_Sub_Process: {
            ns0#Business_Sub_Process_Parameters: {
              ns0#Skip: true
            }
          },
          ns0#Assign_Pay_Group_Sub_Process: {
            ns0#Business_Sub_Process_Parameters: {
              ns0#Skip: true
            }
          },
          ns0#Assign_Costing_Allocation_Sub_Process: {
            ns0#Business_Sub_Process_Parameters: {
              ns0#Skip: true
            }
          }
        }
      }
    }
    ```
6. Workday Connector への入力は次のようになります。
    
    ```xml
    <ns0:Create_Position_Request xmlns:ns0="urn:com.workday/bsvc">
      <ns0:Business_Process_Parameters>
        <ns0:Auto_Complete>true</ns0:Auto_Complete>
        <ns0:Run_Now>true</ns0:Run_Now>
      </ns0:Business_Process_Parameters>
      <ns0:Create_Position_Data>
        <ns0:Supervisory_Organization_Reference>
          <ns0:ID ns0:type="Organization_Reference_ID">SUPERVISORY_ORGANIZATION-6-226</ns0:ID>
        </ns0:Supervisory_Organization_Reference>
        <ns0:Position_Data>
          <ns0:Job_Posting_Title>General Manager</ns0:Job_Posting_Title>
        </ns0:Position_Data>
        <ns0:Position_Group_Restrictions_Data>
          <ns0:Availability_Date>2019-07-06</ns0:Availability_Date>
          <ns0:Earliest_Hire_Date>2019-07-08</ns0:Earliest_Hire_Date>
        </ns0:Position_Group_Restrictions_Data>
        <ns0:Edit_Assign_Organization_Sub_Process>
          <ns0:Business_Sub_Process_Parameters>
            <ns0:Skip>true</ns0:Skip>
          </ns0:Business_Sub_Process_Parameters>
        </ns0:Edit_Assign_Organization_Sub_Process>
        <ns0:Request_Default_Compensation_Sub_Process>
          <ns0:Business_Sub_Process_Parameters>
            <ns0:Skip>true</ns0:Skip>
          </ns0:Business_Sub_Process_Parameters>
        </ns0:Request_Default_Compensation_Sub_Process>
        <ns0:Assign_Pay_Group_Sub_Process>
          <ns0:Business_Sub_Process_Parameters>
            <ns0:Skip>true</ns0:Skip>
          </ns0:Business_Sub_Process_Parameters>
        </ns0:Assign_Pay_Group_Sub_Process>
        <ns0:Assign_Costing_Allocation_Sub_Process>
          <ns0:Business_Sub_Process_Parameters>
            <ns0:Skip>true</ns0:Skip>
          </ns0:Business_Sub_Process_Parameters>
        </ns0:Assign_Costing_Allocation_Sub_Process>
      </ns0:Create_Position_Data>
    </ns0:Create_Position_Request>
    ```
7. コネクタを選択します。
8. Web サービスとコンテンツが含まれる操作を選択します。この例では、コンテンツはペイロードです。
    
    **\[Service (サービス)\]**​ 項目と ​**\[Operation (操作)\]**​ 項目のメニュー項目として値が表示されるようにしてください。名前は、コネクタがメタデータを読み込むと入力されます。 名前を手動で入力しないでください。
9. 次の例のように、Workday サーバーへの接続のための Workday 設定をセットアップし、テストして、保存します。
    
    - **名前**​: `My Workday Config`​
    - **Connection (接続)**​: `Basic Authentication Api`​
    - **Username (ユーザー名)**​: `my_user_name`​
    - **Password (パスワード)**​: `my_password`​
    - **Tenant Name (テナント名)**​: `my_tenant_name`​
    - **Host Name (ホスト名)**​: `impl-cc.workday.com`
    
    接続に失敗した場合テストは、無効な接続パラメーターを確認して修正し、接続をもう一度テストしてください。
10. **Logger**​ コンポーネントをフローに追加して ​`payload`​ をメッセージとして設定します。
11. アプリケーションをデプロイ、同期、または実行します。
12. アプリケーションをテストするため、ブラウザーまたは cURL などのアプリケーションで ​`http://<Deployment_url>:8081/create_position`​ を開きます。
    
    応答は次のようになります。
    
    ```xml
    <wd:Create_Position_Response xmlns:wd="urn:com.workday/bsvc" wd:version="v36.0">
      <wd:Event_Reference>
      <wd:ID wd:type="WID">WID_VALUE</wd:ID>
      </wd:Event_Reference>
      <wd:Position_Reference>
        <wd:ID wd:type="WID">WID_VALUE</wd:ID>
        <wd:ID wd:type="Position_ID">P-11158</wd:ID>
      </wd:Position_Reference>
    </wd:Create_Position_Response>
    ```
    
    ロガーは次のメッセージを表示します。
    
    ```xml
    {Create_Position_Response={Event_Reference={ID=WID_VALUE}, Position_Reference={ID=P-11158}}}
    ```

## [](#関連情報)関連情報

- [Anypoint Connector の概要](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [MuleSoft ヘルプセンター](https://help.mulesoft.com)