更新时间:2022-06-02 17:49:47
JAX-WS基于JAXB,因此您只能将JAXB支持的类型作为Web方法参数传递。因此,任何正确注释的用户定义类(如下所述)都可以用作任何WebMethod的参数或返回类型
JAX-WS is based on JAXB so you can pass only JAXB supported types as a web method parameters. So any user defined class properly annotated such as mentioned below can be used as parameter or return type of any WebMethod
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Person")
public class Person {
@XmlElement(name = "firstName")
protected String firstName;
@XmlElement(name = "lastName")
protected String lastName;
public String getFirstName() {
return firstName;
}
public void setFirstName(String value) {
this.firstName = value;
}
public String getLastName() {
return lastName;
}
public void setLastName(String value) {
this.lastName = value;
}
}