JAX-WS ツールを使用することにより、WSDL ファイルから開始する際に、 JAX-WS Web サービスの作成に必要な Java 成果物を生成できます。
WSDL ファイルがローカル・ファイルである場合、URL は file:drive:¥path¥file_name.wsdl のようになります。
WSDL ファイルがローカル・ファイルである場合、URL は file:/path/file_name.wsdl のようになります。
また、絶対または相対ファイル・システム・パスを使用してローカル・ファイルを指定することもできます。
<?xml version="1.0" encoding="UTF-8"?> <!-- * This program may be used, run, copied, modified and distributed * without royalty for the purpose of developing, using, marketing, or distributing. --> <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://com/ibm/was/wssample/sei/ping/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="PingService" targetNamespace="http://com/ibm/was/wssample/sei/ping/"> <wsdl:types> <xsd:schema targetNamespace="http://com/ibm/was/wssample/sei/ping/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="pingStringInput"> <xsd:complexType> <xsd:sequence> <xsd:element name="pingInput" type="xsd:string" /> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </wsdl:types> <wsdl:message name="pingOperationRequest"> <wsdl:part element="tns:pingStringInput" name="parameter" /> </wsdl:message> <wsdl:portType name="PingServicePortType"> <wsdl:operation name="pingOperation"> <wsdl:input message="tns:pingOperationRequest" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="PingSOAP" type="tns:PingServicePortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="pingOperation"> <soap:operation soapAction="pingOperation" style="document" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> </wsdl:operation> </wsdl:binding> <wsdl:service name="PingService"> <wsdl:port binding="tns:PingSOAP" name="PingServicePort"> <soap:address location="http://localhost:9080/WSSampleSei/PingService" /> </wsdl:port> </wsdl:service> </wsdl:definitions>
app_server_root¥bin¥wsimport -keep -verbose ping.wsdl
. ./setupCmdLine.sh (ピリオド間のスペースに注意してください。)次の wsimport コマンドを実行します。
app_server_root/bin/wsimport -keep -verbose ping.wsdl
com¥ibm¥was¥wssample¥sei¥ping¥ObjectFactory.java com¥ibm¥was¥wssample¥sei¥ping¥package-info.java com¥ibm¥was¥wssample¥sei¥ping¥PingServicePortType.java com¥ibm¥was¥wssample¥sei¥ping¥PingStringInput.javacom¥ibm¥was¥wssample¥sei¥ping¥PingService.java
ObjectFactory.java ファイルには、Java コンテンツ・インターフェース、および関連の ping パッケージに生成された Java エレメント・インターフェース別にファクトリー・メソッドが含まれています。 package-info.java ファイルは targetNamespace の値を使用し、ディレクトリー構造を作成します。 PingServicePortType.java ファイルは、生成されたサービス・エンドポイント・インターフェース (SEI) クラスであり、ping メソッド定義を含みます。 PinStringInput.java ファイルには、JAXB 生成のタイプ値が含まれています。 これらの値は XML スキーマ・タイプからマップされる Java クラスです。 PingService.java ファイルは、生成されたサービス・プロバイダーのクラス・ファイルであり、 JAX-WS クライアントによって使用されます。