Springws-write-client
提供:Dev Guides
Spring WS-ライティングクライアント
この章では、Spring WSを使用して、リンク:/springws/springws_write_server [Spring WS-Writing Server]で作成されたWebアプリケーションサーバーのクライアントを作成する方法を学びます。
Step | Description |
---|---|
1 | Update the project countryService under the package com.finddevguides as explained in the Spring WS – Writing Server chapter. |
2 | Create CountryServiceClient.java under the package com.finddevguides.client and MainApp.java under the package com.finddevguides as explained in the following steps. |
CountryServiceClient.java
MainApp.java
Webサービスを開始する
Tomcatサーバーを起動し、標準ブラウザーを使用してwebappsフォルダーから他のWebページにアクセスできることを確認します。
Webサービスクライアントのテスト
Eclipseの下のアプリケーションでMainApp.javaを右クリックし、「Javaアプリケーションとして実行」コマンドを使用します。 アプリケーションで問題がなければ、次のメッセージが出力されます。
ここでは、SOAPベースのWebサービス用のクライアント- CountryServiceClient.java を作成しました。 MainAppは、CountryServiceClientを使用してWebサービスにヒットし、ポストリクエストを行い、データを取得します。