このトピックでは、Web サービス開発の際に使用される WSDL2Java および Java2WSDL コマンド行ツールのトラブルシューティングについて論じます。
このトピックの各セクションでは、WSDL2Java または Java2WSDL ツールの使用中に経験する可能性のある問題を取り上げます。 また、それらの問題のトラブルシューティングに役立つ解決策が 提示されています。
.Net クライアントで、Vector タイプのパラメーターを指定した Web サービス・メソッドが反映されない
System.InvalidOperationException: Method AnnuityInteropService.wsListAnnuityByHolder can not be reflected. System.InvalidOperationException: There was an error reflecting wsListAnnuityByHolderResult. System.InvalidOperationException: The Form property might not be unqualified when an explicit namespace property is available.
この問題が発生するのは、サーバー・サイド・メソッドが Vector を戻し、 Web サービス記述言語 (WSDL) ファイルのスタイルが document/literal で、かつフォームが非修飾である場合です。 document/literal スタイルでは、必ず非修飾のフォームが 生成されます。これは、デフォルトで elementFormDefault="unqualified" になっているためです。
この問題を回避するため、WebSphere Application Server にデプロイされる Web サービス・メソッドでは、 Vector パラメーターを使用しないでください。 Web サービス・メソッドの Vector パラメーターは、 .Net クライアントや Java コレクション・タイプでは機能しません。
ハイパー・スレッディング対応マシンで Endpoint Enabler ツールを使用したときのエラー
ハイパー・スレッディング対応マシンで Endpoint Enabler ツールを実行すると、 「タスク」ビューに、エンタープライズ・アプリケーション・プロジェクトに対するエラーが報告されます。 エンタープライズ・アプリケーション・プロジェクトは、ワークベンチを再始動するまで削除できません。
この問題は、自動ビルドと Enterprise JavaBeans (EJB) プロジェクト・バリデーターの間に 競合状態が存在する場合に発生することがあります。
この問題を解決するには、ワークベンチの自動ビルドをオフにしてから Endpoint Enabler ツールを 実行し、その後、自動ビルドをオンに戻します。
JSR109 バージョン 1.0 および 1.1 でのマルチプロトコル・ポート・コンポーネントの制約事項
Java2WSDL コマンド行ツールによって生成された http、 jms、および ejb バインディングを持つ WSDL ファイルを含んだ エンタープライズ・アーカイブ (EAR) ファイルをデプロイする際に、Java Specification Requests (JSR) 109 仕様の 検証エラーが発生します。
JSR 109 仕様では、 webservices.xml デプロイメント記述子ファイルで定義された各ポート・コンポーネントは、 JavaBeans インプリメンテーションの場合、web.xml ファイルにある固有の <servlet-class> エレメントを参照し、 EJB インプリメンテーションの場合、ejb-jar.xml ファイルにある固有の <session> エレメントを 参照する必要があります。 サーブレットおよびセッション EJB は、 <servlet-link> または <ejb-link> エレメントによって表される webservices.xml ファイルにあります。
WSDL2Java コマンド行ツールは、 WSDL ファイルで検出されたポートを、生成された webservices.xml ファイル内の ポート・コンポーネントにマップします。 単一の Web サービスに、これらの各バインディングの ポートのほかに複数のバインディングが存在する場合、webservices.xml ファイルには、 複数のポート・コンポーネントが含まれ、これらのポート・コンポーネントはすべて、同じ EJB モジュール (<session>) または JavaBeans (<servlet-class>) 実装を指す必要があります。 JSR 109 の制約事項のため、webservices.xml ファイルは無効であり、 デプロイメント・プロセス時にエラーが発生することがあります。
Error in <module> : CHKW6030E: Implementation class <class> referred to by port components<port1> and <port2>. (JSR109 1.0: 7.1.2).以下は、サンプル・データを含んだエラーです。
Error in WebSvcsInSession20EJB.jar : CHKW6030E: Implementation class WSMultiProtocol referred to by port components WSMultiProtocolJMS and WSMultiProtocolEJB.(JSR109 1.0: 7.1.2).
ejb-jar.xml ファイル内に、同じインプリメンテーション・クラス、 ホーム・インターフェース、およびリモート・インターフェースをすべてポイント する複数の <session> EJB 定義を作成することによって、この制約事項を 回避することができます。 これらのクラスは今後も使用することができますが、 クラスおよびインターフェースを参照する ejb-jar.xml ファイルの <session> 定義を複製する必要があります。
<webservices> <webservice-description> <webservice-description-name>WSMultiProtocolService</webservice-description-name> <wsdl-file>META-INF/wsdl/WSMultiProtocol.wsdl</wsdl-file> <jaxrpc-mapping file>META-INF/WSMultiProtocol_mapping.xml</jaxrpc-mapping file> <port-component> <port-component-name>WSMultiProtocolEjb</port-component-name> <wsdl-port> <namespaceURI>http://ejb.pli.tc.wssvt.ibm.com</namespaceURI> <localpart>WSMultiProtocolEjb</localpart> </wsdl-port> <service-endpoint-interface>com.ibm.wssvt.tc.pli.ejb.WSMultiProtocol </service-endpoint-interface> <service-impl-bean> <ejb-link>WSMultiProtocol</ejb-link> </service-impl-bean> </port-component> <port-component> <port-component-name>WSMultiProtocolJMS</port-component-name> <wsdl-port> <namespaceURI>http://ejb.pli.tc.wssvt.ibm.com</namespaceURI> <localpart>WSMultiProtocolJMS</localpart> </wsdlport> <service-endpoint-interface>com.ibm.wssvt.tc.pli.ejb.WSMultiProtocol </service-endpoint-interface> <service-impl-bean> <ejb-link>WSMultiProtocol_2</ejb-link> </service-impl_bean> </port-component> <port-component> <port-component-name>WSMultiProtocolJMS</port-component-name> <wsdl-port> <namespaceURI>http://ejb.pli.tc.wssvt.ibm.com</namespaceURI> <localpart>WSMultiProtocolJMS</localpart> </wsdlport> <service-endpoint-interface>com.ibm.wssvt.tc.pli.ejb.WSMultiProtocol </service-endpoint-interface> <service-impl-bean> <ejb-link>WSMultiProtocol_3</ejb-link> </service-impl_bean> </port-component> </webservice-description> </webservices>以下は、ejb-jar.xml ファイルの例です。 クラスおよびインターフェースと探して、 それらがどのように複製されているかを確認してください。
<ejb-jar-id="ejb-jar_ID"> <display-name>WebSvcsInsSession20EJB</display-name> <enterprise-beans> <session-id="WSMultiProtocol"> <ejb-name>WSMultiProtocol</ejb-name> <home>com.ibm.wssvt.tc.pli.ejb.WSMultiProtocolHome</home> <remote>com.ibm.wssvt.tc.pli.ejb.WSMultiProtocol</remote> <ejb-class>com.ibm.wssvt.tc.pli.ejb.WSMultiProtocolWebSvcsBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> <ejb-ref-id="EjbRef_1082407586720"> <description></description> <ejb-ref-name>ejb/BeneficiarySession</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <home>com.ibm.wssvt.tc.pli.ejb.BeneficiarySessionHome</home> <remote>com.ibm.wssvt.tc.pli.ejb.BeneficiarySession</remote> <ejb-link>PolicySession20EJB.jar#BeneficiarySession</ejb-link> </ejb-ref> <ejb-ref-id="EjbRef_1082407586790"> <description></description> <ejb-ref-name>ejb/PolicySession</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <home>com.ibm.wssvt.tc.pli.ejb.PolicySessionHome</home> <remote>com.ibm.wssvt.tc.pli.ejb.PolicySession</remote> <ejb-link>PolicySession20EJB.jar#PolicySession</ejb-link> </ejb-ref> <session-id="WSMultiProtocol_2"> <ejb-name>WSMultiProtocol_2</ejb-name> <home>com.ibm.wssvt.tc.pli.ejb.WSMultiProtocolHome</home> <remote>com.ibm.wssvt.tc.pli.ejb.WSMultiProtocol</remote> <ejb-class>com.ibm.wssvt.tc.pli.ejb.WSMultiProtocolWebSvcsBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> <ejb-ref-id="EjbRef_1082407586720_2"> <description></description> <ejb-ref-name>ejb/BeneficiarySession</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <home>com.ibm.wssvt.tc.pli.ejb.BeneficiarySessionHome</home> <remote>com.ibm.wssvt.tc.pli.ejb.BeneficiarySession</remote> <ejb-link>PolicySession20EJB.jar#BeneficiarySession</ejb-link> </ejb-ref> <ejb-ref-id="EjbRef_1082407586790_2"> <description></description> <ejb-ref-name>ejb/PolicySession</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <home>com.ibm.wssvt.tc.pli.ejb.PolicySessionHome</home> <remote>com.ibm.wssvt.tc.pli.ejb.PolicySession</remote> <ejb-link>PolicySession20EJB.jar#PolicySession</ejb-link> </ejb-ref> <session-id="WSMultiProtocol_3"> <ejb-name>WSMultiProtocol_3</ejb-name> <home>com.ibm.wssvt.tc.pli.ejb.WSMultiProtocolHome</home> <remote>com.ibm.wssvt.tc.pli.ejb.WSMultiProtocol</remote> <ejb-class>com.ibm.wssvt.tc.pli.ejb.WSMultiProtocolWebSvcsBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Container</transaction-type> <ejb-ref-id="EjbRef_1082407586790_3"> <description></description> <ejb-ref-name>ejb/BeneficiarySession</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <home>com.ibm.wssvt.tc.pli.ejb.BeneficiarySessionHome</home> <remote>com.ibm.wssvt.tc.pli.ejb.BeneficiarySession</remote> <ejb-link>PolicySession20EJB.jar#BeneficiarySession</ejb-link> </ejb-ref> <ejb-ref-id="EjbRef_1082407586790_3"> <description></description> <ejb-ref-name>ejb/PolicySession</ejb-ref-name> <ejb-ref-type>Session</ejb-ref-type> <home>com.ibm.wssvt.tc.pli.ejb.PolicySessionHome</home> <remote>com.ibm.wssvt.tc.pli.ejb.PolicySession</remote> <ejb-link>PolicySession20EJB.jar#PolicySession</ejb-link> </ejb-ref> </session>
暫定修正、修正パッケージ、 またはリフレッシュ・パックのアンインストール後のアプリケーション・エラーの回避
あるアプリケーションが特定の修正が提供する機能を使用している場合にその修正を除去すると、 そのアプリケーションからエラー・メッセージが表示されます。 修正を除去する場合は、アプリケーションの再テストを行って、 エラーの有無を確認してください。 修正を除去したためにエラー・メッセージを表示するアプリケーションがあれば、 すべて再デプロイします。
例えば、WebSphere Application Server に 修正パッケージをインストールし、株価情報の Web サービス StockQuote を作成するとします。 WSDL2Java コマンド行ツールをデプロイヤー役割で使用して、 AgnosticService クラスを拡張する ServiceLocator クラスを生成します。
java.lang.NoClassDefFoundError: Error while defining class: com.ibm.ws.wsfvt.test.stockquote.StockQuoteServiceLocator This error indicates that the class: com.ibm.webservices.multiprotocol.AgnosticService could not be located while defining the class: com.ibm.ws.wsfvt.test.stockquote.StockQuoteServiceLocator使用する Web サービス・クラスでサポートされていない バージョンの WebSphere Application Server を使用しないコードを出力するには、 WebSphere Application Server 上でアプリケーションを再デプロイする必要があります。
Linux および AIX オペレーティング・システムでは、install_root/bin/setupCmdLine.sh ファイルを編集して、 WAS_CLASSPATH 環境変数を設定している行の末尾に $install_root/lib/urlprotocols.jar を追加します。