例: WS-Notification サブスクリプションの一時停止

このタスクは、示されているコード例の抜粋に基づいて、サブスクライバー・ロールを果たす JAX-RPC クライアントが、コンシューマー・アプリケーションのサブスクリプションを一時停止するコードを作成する場合に使用します。

このタスクについて

この例は 、Java™ API for XML-based remote procedure calls (JAX-RPC) API と、WSDL2Java ツール (WS-Notification サービス・ポイントの作成の結果として生成された Notification Broker WSDL に対し実行) および WebSphere® Application Server API および SPI を使用して生成されたコードと併せた使用を基にしています。

WebSphere Application Server では、WS-Notification サービスにはバージョン 6.1 およびバージョン 7.0 の 2 つの実装があります。この JAX-RPC 例は、バージョン 6.1 またはバージョン 7.0 WS-Notification サービス・ポイントと正常にやり取りすることができます。 ただし、WS-Notification をポリシー・セットと一緒に使用したい場合は (例えば、WS-ReliableMessaging による構成を可能にするため)、Java API for XML-based Web Services (JAX-WS) プログラミング・モデルを使用するように WS-Notification アプリケーションをエンコードする必要があります。なおかつ WS-Notification アプリケーションはバージョン 7.0 WS-Notification サービス・ポイントとやり取りする必要があります。 JAX-WS クライアント・アプリケーションをプログラミングした経験がない場合は、以下のトピックを参照してください。

手順

  1. JAX-RPC サービスを検索します。 The JNDI name is specific to your Web services client implementation. PauseSubscription 操作は SubscriptionManager サービスに属しています。
  2. 操作の呼び出しを行うポートのスタブを取得します。
  3. 一時停止するサブスクリプションに要求を関連付けます。 subscriptionEPR は、サブスクライブ操作を呼び出して返された EndpointReference です。
  4. オプションの情報があれば、作成します。
  5. スタブで関連付けられているメソッドを呼び出して、PauseSubscription 操作を呼び出します。

例

以下は、サブスクライバー・ロールを果たす JAX-RPC クライアントが、コンシューマー・アプリケーションのサブスクリプションを一時停止するコード例を示したものです。

// Look up the JAX-RPC service. The JNDI name is specific to your Web services client implementation.
// The PauseSubscription operation belongs to the SubscriptionManager service
InitialContext context = new InitialContext();
javax.xml.rpc.Service service = (javax.xml.rpc.Service) context.lookup("java:comp/env/services/SubscriptionManager");

// Get a stub for the port on which you want to invoke operations
SubscriptionManager stub = (SubscriptionManager) service.getPort(SubscriptionManager.class);

// Associate the request with the subscription you want to pause. The subscriptionEPR is the
// EndpointReference returned by the invocation of the Subscribe operation
((Stub) stub)._setProperty(WSAConstants.WSADDRESSING_DESTINATION_EPR, subscriptionEPR);

// Create any optional information
SOAPElement[] optionalInformation =  new SOAPElement[] {};

// Invoke the PauseSubscription operation by calling the associated method on the stub
SOAPElement[] additionalReturnedInformation = stub.pauseSubscription(optionalInformation);

トピックのタイプを示すアイコン タスク・トピック



タイム・スタンプ・アイコン 最終更新: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-base-dist&topic=tjwsn_ex_sub_pause
ファイル名:tjwsn_ex_sub_pause.html