我猜想你重新研究这一问题。
<complexType name= ArrayOfString >
<sequence>
<element name= item type= xsd:string maxOccurs= unbounded />
</sequence>
</complexType>
资料来源:。
最新资料:
我先使用NetBeans 7.0.1进行测试。 结果是:
2. 申报一种收取固定参数的方法:
@WebMethod(operationName = "helloArray")
public String helloArray(@WebParam(name = "name") String[] name) {
StringBuilder sb = new StringBuilder("Hello ");
if (name != null) {
for(int i = 0; i < name.length; i++) {
sb.append(name[i]);
if (i < (name.length - 1)) {
sb.append(" and ");
}
}
}
sb.append( ! );
return sb.toString();
}
WSDL在我的方法中产生了一种复杂的类型,它包含一个阵容要素。
<xs:complexType name="helloArray">
<xs:sequence>
<xs:element name="name" type="xs:string" nillable="true" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
在客户中,民主选举学会生成了一个<代码>List<String>,用于消费:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "helloArray", propOrder = {"name"})
public class HelloArray {
@XmlElement(nillable = true)
protected List<String> name;
public List<String> getName() {
if (name == null) {
name = new ArrayList<String>();
}
return this.name;
}
}
And a method to consume the service
private String helloArray(java.util.List<java.lang.String> name) {
edu.home.wsclient.HelloWorldWS port = service.getHelloWorldWSPort();
return port.helloArray(name);
}
I ve uploaded both projects in this address