Reputation: 15844
I have this class
public class Header {
@XmlAnyElement(lax = true)
protected List<Object> any;
// getters/setters omitted
}
How can I (in JAX-WS WebMethod) create an element ID in header that would look like this?
<Header>
<ID>value</ID>
</Header>
Upvotes: 1
Views: 1537
Reputation: 149007
You could have a class like the following and add an instance of it into the any
property, or you could add an instance of org.w3c.dom.Element
representing the ID
element to the collection.
@XmlRootElement(name="ID")
@XmlAccessorType(XmlAccessType.FIELD)
public class ID {
@XmlValue
private String value;
}
Upvotes: 2