@XmlElement(required=true) for @WebParam does not work

前端 未结 5 679
情歌与酒
情歌与酒 2020-12-31 05:27

I\'m building web service using JAX-WS. I have a strange problem that the annotation @XmlElement(required=true) for @WebParam works in some @

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-31 06:10

    If you are having the following error message: "The annotation @XmlElement is disallowed for this location", chances are you're using the wrong import statement.

    Change it to:

    import javax.xml.bind.annotation.XmlElement;
    

    As Eclipse suggests another package as the first option, it's a very common mistake.

提交回复
热议问题