10.5.1 配列のパラメタを持つ場合
次に示すJavaメソッドを持つSEIを起点に,Webサービスを開発することを想定します。このJavaメソッドは,配列(int型)のパラメタを持ちます。
@WebMethod public void test1( int[] param1 );
この場合にマッピングされるWSDLの一部を次に示します。
... <types> <xsd:schema targetNamespace="http://cosminexus.com/jaxws"> <xs:element name="test1" type="tns:test1"/> <xs:element name="test1Response" type="tns:test1Response"/> <xs:complexType name="test1"> <xs:element name="arg0" type="xs:int" nillable="true" minOccurs="0" maxOccurs="unbounded" /> </xs:complexType> <xs:complexType name="test1Response"> <xs:sequence/> </xs:complexType> </xs:element> </types> <message name="test1"> <part name="parameters" element="tns:test1"/> </message> <message name="test1Response"> <part name="parameters" element="tns:test1Response"/> </message> <portType ...> <operation name="test1"> <input message="tns:test1"/> <output message="tns:test1Response"/> </operation> ... </portType> ...
パラメタは,maxOccurs="unbounded"のwrapper子要素にマッピングされます。
このWSDLを指定してcjwsimportコマンドを実行すると,生成されるサービスクラスのJavaメソッドは次のようになります。
@WebMethod public String test1( java.util.List<Integer> arg0 );
maxOccurs="unbounded"のwrapper子要素は,java.util.Listクラスにマッピングされます。また,この場合,xsd:int型は,java.lang.Integerクラスにマッピングされます。