10.5.3 non-wrapperスタイルの配列
次に示すJavaメソッドを持つSEIを起点に,Webサービスを開発することを想定します。このJavaメソッドは,non-wrapperスタイルで,java.lang.Stringクラスの配列のパラメタを持ちます。
@WebMethod @javax.jws.soap.SOAPBinding( parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.BARE) public String test1( String[] param1 );
この場合にマッピングされるWSDLの一部を次に示します。
...
<types>
<xsd:schema targetNamespace="http://jaxb.dev.java.net/array">
<xsd:complexType name="stringArray" final="#all">
<xsd:sequence>
<xsd:element name="item" type="xsd:string" minOccurs="0"
maxOccurs="unbounded" nillable="true" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
<xsd:schema targetNamespace="http://cosminexus.com/jaxws"
xmlns:ns1="http://jaxb.dev.java.net/array">
<xsd:element name="test1" nillable="true" type="ns1:stringArray"/>
<xsd:element name="test1Response" nillable="true" type="xsd:string"/>
</xsd:schema>
</types>
<message name="test1">
<part name="test1" element="tns:test1" />
</message>
<message name="test1Response">
<part name="test1Response" element="tns:test1Response" />
</message>
<portType ...>
<operation name="test1">
<input message="tns:test1" />
<output message="tns:test1Response" />
</operation>
...
</portType>
...パラメタは,{http://jaxb.dev.java.net/array}stringArray型のwrapper子要素にマッピングされます。
このWSDLを指定してcjwsimportコマンドを実行すると,生成されるサービスクラスのJavaメソッドは次のようになります。
@WebMethod @javax.jws.soap.SOAPBinding( parameterStyle=javax.jws.soap.SOAPBinding.ParameterStyle.BARE) public String test1(net.java.dev.jaxb.array.StringArray test1);
{http://jaxb.dev.java.net/array}stringArray型のwrapper子要素は,net.java.dev.jaxb.array.StringArrayクラスにマッピングされます。