4.1.3 WSDLを生成する
Java2WSDLコマンドを使用して,「4.1.2 Javaインタフェースを作成する」で作成したインタフェースおよびユーザ定義のデータ型クラスから,SOAPアプリケーションのWSDLを生成します。
Java2WSDLコマンドの指定例を示します。
Java2WSDL.bat -l http://localhost:8080/WebApp1/services/UserInfo localhost.UserInfo
このコマンドを実行すると,カレントディレクトリにUserInfo.wsdlという名前のWSDLが生成されます。
この例では,-lオプションでSOAPサービスのエンドポイントURLを指定していますが,必要に応じてほかのオプションも使用してください。オプションについては,「9.1 Java2WSDLコマンド(WSDLの生成)」を参照してください。
この操作によって,生成されたWSDLの例を次に示します。背景色付きの太字部分はこの操作によって設定された情報です。
<?xml version="1.0" encoding="UTF-8" ?> <wsdl:definitions name="UserInfo" targetNamespace="http://localhost" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:impl="http://localhost-impl" xmlns:intf="http://localhost" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <types> <schema targetNamespace="http://localhost" xmlns="http://www.w3.org/2001/XMLSchema"> <complexType name="UserData"> <sequence> <element name="name" nillable="true" type="xsd:string" /> <element name="section" nillable="true" type="xsd:string" /> <element name="telephone" nillable="true" type="xsd:string" /> </sequence> </complexType> <element name="UserData" nillable="true" type="intf:UserData" /> </schema> </types> <wsdl:message name="getUserDataResponse"> <wsdl:part name="return" type="intf:UserData" /> </wsdl:message> <wsdl:message name="getUserDataRequest"> <wsdl:part name="in0" type="xsd:string" /> </wsdl:message> <wsdl:portType name="UserInfo"> <wsdl:operation name="getUserData" parameterOrder="in0"> <wsdl:input message="intf:getUserDataRequest" /> <wsdl:output message="intf:getUserDataResponse" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="UserInfoSoapBinding" type="intf:UserInfo"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="getUserData"> <soap:operation soapAction="" /> <wsdl:input> <soap:body namespace="http://localhost" use="literal" /> </wsdl:input> <wsdl:output> <soap:body namespace="http://localhost" 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>
- 注意事項
-
-
use属性に"encoded"を指定した場合,SOAP符号化規則はSOAPエンコーディングとなります。
-
use属性に"literal"を指定した場合,SOAP符号化規則はリテラルエンコーディングとなります。
-
SOAP符号化規則については「1.4.1 SOAPの概要」を参照してください。
-