Java2WSDLコマンドを使用して,「4.4.2 Javaインタフェースを作成する」で作成したインタフェースおよびユーザ定義のデータ型クラスから,SOAPアプリケーションのWSDLを生成します。
RPC形態の添付ファイルは,document/literalに対応したSOAPアプリケーションだけで使用できます。そのため,Java2WSDLコマンドの実行時には,-zオプションに「DOCUMENT」,-uオプションに「LITERAL」を指定してください。
Java2WSDLコマンドの指定例を示します。
Java2WSDL.bat -l http://localhost:8080/WebApp1/services/UserInfo -z DOCUMENT -u LITERAL localhost.UserInfo
このコマンドを実行すると,カレントディレクトリにUserInfo.wsdlという名前のWSDLが生成されます。
この例では,-lオプションでSOAPサービスのエンドポイントURLを指定していますが,必要に応じてほかのオプションも使用してください。オプションについては,「9.1 Java2WSDLコマンド(WSDLの生成)」を参照してください。
この操作によって,生成されたWSDLの例を次に示します。太字部分はこの操作によって設定された情報です。
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://localhost"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://localhost-impl"
xmlns:intf="http://localhost"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://localhost"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://ws-i.org/profiles/basic/1.1/xsd"/>
<element name="getUserData">
<complexType>
<sequence>
<element name="in0" type="xsd:string"/>
<element name="in1" type="wsi:swaRef"/>
</sequence>
</complexType>
</element>
<element name="getUserDataResponse">
<complexType>
<sequence>
<element name="getUserDataReturn" type="intf:UserData"/>
</sequence>
</complexType>
</element>
<complexType name="UserData">
<sequence>
<element name="message" nillable="true" type="xsd:string"/>
<element name="name" nillable="true" type="xsd:string"/>
<element name="section" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="getUserDataRequest">
<wsdl:part element="intf:getUserData" name="parameters"/>
</wsdl:message>
<wsdl:message name="getUserDataResponse">
<wsdl:part element="intf:getUserDataResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="UserInfo">
<wsdl:operation name="getUserData">
<wsdl:input message="intf:getUserDataRequest" name="getUserDataRequest"/>
<wsdl:output message="intf:getUserDataResponse" name="getUserDataResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="UserInfoSoapBinding" type="intf:UserInfo">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getUserData">
<soap:operation soapAction=""/>
<wsdl:input name="getUserDataRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getUserDataResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="UserInfoService">
<wsdl:port binding="intf:UserInfoSoapBinding" name="UserInfo">
<soap:address location="http://localhost:8080/WebApp1/services/UserInfo"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>