• 検索結果がありません。

Consuming a simple Web Service

N/A
N/A
Protected

Academic year: 2021

シェア "Consuming a simple Web Service"

Copied!
13
0
0

読み込み中.... (全文を見る)

全文

(1)

Consume a Simple Web Service 1

Consume a Simple Web Service

(シンプルな Web サービスを利用する)

【目次】

1 Introduction(はじめに) ... 2 2 Importing a WSDL(WSDL をインポートする) ... 3 3 Creating Logic to Call the Web Service

(Web サービスを呼び出すロジックを作成する) ... 5 4 Related Content(関連するコンテンツ) ... 12

(2)

Consume a Simple Web Service 2

1 Introduction(はじめに)

Mendix はエンタープライズ向けのアプリ・プラットフォームですが、エンタープライズ・ソ フトウェアでグリーンフィールド(https://en.wikipedia.org/wiki/Greenfield)開発を行う機 会はほとんどないと思います。大抵のケースでは、既存のシステムと統合する必要があるでし ょう。Mendix は様々な統合方法に対応していますが、この章では Mendix で Web サービスを 利用する方法に注目します。

この章では、W3Schoolsというサンプル Web サービスを使用します。これは、温度を摂氏か ら華氏、または華氏から摂氏に変換するための非常にシンプルな Web サービスです。変換され た温度は、文字列値として戻され、直接変数として保存できます。複雑な XML メッセージを戻 す Web サービスを呼び出す場合は、How to Import XML Documentsで説明している XML か らドメインへのマッピングを使うことができます。

この章では、以下の内容を学習します。

 WSDL のインポート方法

(3)

Consume a Simple Web Service 3

2 Importing a WSDL(WSDL をインポートする)

WSDL とは Web サービスのオペレーションを記述するものであり、これをモデラーにインポー トすることができます。WSDL をインポートすれば、マイクロフロー・エディタで瞬時に Web サービスのオペレーションを起動させることができます。 WSDL をインポートするには、以下の手順に従います。

1. Project Explorer で 該 当 の モ ジ ュ ー ル を 右 ク リ ッ ク し 、 メ ニ ュ ー か ら Add >

Document を選択します(Ctrl+N のショートカットキーを使うこともできます)。

2. New Document ポップアップ・ウィンドウの Document type で Consumed web

service を選択し、作成先として Location からモジュールまたはフォルダーを選択しま

(4)

Consume a Simple Web Service 4 3. OK を ク リ ッ ク し 、 新 規 利 用 Web サ ー ビ ス の 名 前 を 入 力 し ま す ( 例 :

TemperatureConverter)。

4. 再度 OK をクリックします。すると、Consumed Web Service エディタが表示されま す。

5. URL に http://www.w3schools.com/webservices/tempconvert.asmx?WSDL と 入 力し、Import をクリックします。すると、Web サービスのポートを選択するための Select Ports ポップアップ・ウィンドウが開きます。

(5)

Consume a Simple Web Service 5 6. OK を ク リ ッ ク し 、 デ フ ォ ル ト の 選 択 肢 を 選 択 し ま す 。 モ デ ラ ー が

CelsiusToFahrenheit と FahrenheitToCelsius のオペレーションをインポートしたは

ずです。

7. OK をクリックし、利用済みの Web サービスを保存します。

3 Creating Logic to Call the Web Service

(Web サービスを呼び出すロジックを作成する)

Web サービスを呼び出すロジックを作成するには、以下の手順に従います。

1. Project Explorer で 該 当 の モ ジ ュ ー ル を 右 ク リ ッ ク し 、 メ ニ ュ ー か ら Add >

(6)

Consume a Simple Web Service 6 2. New Document ポップアップ・ウィンドウの Document type で Microflow を選択し、

作成先として Location からモジュールまたはフォルダーを選択します。

3. OK を ク リ ッ ク し 、 新 規 マ イ ク ロ フ ロ ー 名 を 入 力 し ま す ( 例 : ConvertCelsiusToFahrenheit)。

(7)

Consume a Simple Web Service 7 5. Toolbox を開きます(モデラーの右下隅から)。

(8)

Consume a Simple Web Service 8 6. Toolbox から start event と end event を結ぶ線に Create variable アクティビティを

ドラッグします。これで、新規アクティビティが挿入されます。

7. 新規挿入されたアクティビティをダブルクリックし、Create Variable のプロパティ・ エディタを開きます。

8. Data Type で Integer/Long を選択し、100 の値を入力、Output Variable 名として TemperatureInCelsius と設定します。

9. OK をクリックします。マイクロフローは以下のようになるはずです。

10. Toolbox から start event と end event を結ぶ線に Call web service アクティビティ をドラッグします。これにより、新規アクティビティが挿入されます。

11. 新規挿入されたアクティビティをダブルクリックし、Call Web Service のプロパテ ィ・エディタを開きます。

(9)

Consume a Simple Web Service 9 12. エディタの Web service call セクションで、Select…をクリックし、Select Web

Service Operation ポップアップ・ウィンドウを開きます。

13. CelsiusToFahrenheit を選択し、Select をクリックします。 14. Celsius (optional)入力パラメーターをダブルクリックします。

(10)

Consume a Simple Web Service 10 15. 式として toString($TemperatureInCelsius)と入力します。Web サービス・オペレー

ションは文字列値を要求するため、toString 関数を使う必要があります。OK をクリッ クします。

16. Store in variable オプションで Yes を選択し、変数を TemperatureInFahrenheit と します。

(11)

Consume a Simple Web Service 11 18. Toolbox から start event と end event を結ぶ線に Show message アクティビティ

をドラッグします。これにより、新規アクティビティが挿入されます。

19. 新規挿入されたアクティビティをダブルクリックし、Show Message のプロパティ・ エディタを開きます。

20. Type で Information を選択し、Template に The temperature in fahrenheit is: {1}と入力します。{1}は、下のパラメーターのプレースホルダーとして機能します。

21. パラメーターを新規作成し、式として$TemperatureInFahrenheit(これは、Web サー ビス・オペレーションの戻り値です)と入力し、OK をクリックします。

(12)

Consume a Simple Web Service 12 22. 再度 OK をクリックし、Show message activity プロパティを保存します。マイクロ

フローは以下のようになるはずです。

23. このマイクロフローをトリガーするメニュー項目を作成します。メニュー項目の作成 方法は、How to Set Up the Navigation Structureをご覧ください。

24. アプリケーションをデプロイし、Web サービス・オペレーションを呼び出すマイクロ フローをトリガーします。メッセージ内の温度表記が変換されているはずです。

4 Related Content(関連するコンテンツ)

 7_1 複雑な Web サービスを利用する  7_2REST サービスを利用する  7_3 シンプルな Web サービスを利用する  7_4XML 文書をエクスポートする  7_5Web サービスを提供する  7_6OData を使って BI ツールにデータを提供する

(13)

Consume a Simple Web Service 13  7_8Excel 文書をインポートする

 7_9XML 文書をインポートする

 7_11Selemium 対応

 7_12LDAP モジュールを使ってユーザー・アカウントを同期する

This Japanese translation is provided for by Buildsystem Co. Ltd., based on Mendix copyrighted documentation and materials which can be found here as licensed under CC BY 4.0

参照

関連したドキュメント

The SLE-revised (SLE-R) questionnaire despite simplicity is a high-performance screening tool for investigating the stress level of life events and its management in both community

Zheng and Yan 7 put efforts into using forward search in planning graph algorithm to solve WSC problem, and it shows a good result which can find a solution in polynomial time

東京都は他の道府県とは値が離れているように見える。相関係数はこう

このマニュアル全体を読んで、Oracle Diagnostics Pack に同梱の Oracle Performance Manager、Oracle Capacity Planner、Oracle TopSessions および Oracle Event

Analogous to the identification of continuous dynamical systems, identification of discrete- event systems DESs consists of determining the mathematical model that describes

本検討で距離 900m を取った位置関係は下図のようになり、2点を結ぶ両矢印線に垂直な破線の波面

In function of the current operating mode, edge on WU leads to an interrupt request (Start−up, Normal, Standby and Flash modes) or reset (Sleep mode).. More details on the

In function of the current operating mode, edge on WU leads to an interrupt request (Start−up, Normal, Standby and Flash modes) or reset (Sleep mode).. More details on the