如何在soap Web服务中创建一个参数?

时间:2014-07-23 08:39:49

标签: java web-services soap jaxb

如何制作soap网络服务所需的参数?

@WebService
public class MyService {
    //how can I make city param required?
    @WebMethod
    public ComplexResponse lookup(@WebParam(name = "city") String city) {

    }
}

1 个答案:

答案 0 :(得分:3)

添加

@XmlElement(required=true, nillable=false)

到param应该工作:

public ComplexResponse lookup(@WebParam(name = "city") @XmlElement(required=true, nillable=false) String city)