Reputation: 60743
I'm building an embedded JAX-WS SOAP service using Java. I'm defining my data types using javax.xml.bind
.
I have a field in one of the data types that I'd like to be hidden, so that it will be supported but not be visible when a WSDL is published.
My motivation is that we are deprecating an attribute however I would to still support it (the contents will be ignored and unused). In the below example, if the user visits the WSDL at http://myservice?wsdl
they will not see the attribute email
as a part of user
Is there any annotation I can use that will provide this functionality? Alternatively
@XmlType
public class User
{
@XmlElement
public String name;
@XmlElement
@Hidden (?)
public String email;
}
Upvotes: 0
Views: 2200
Reputation: 2122
I don't know of any standard way to tell CXF to ignore an element in the generated WSDL. One option would be to maintain a static WSDL file, and then manually remove the "hidden" element from the schema. You can leave the field in the JAXB annotated classes. If you are configuring the service with Spring, you can add a WSDL with the wsdlLocation attribute:
<jaxws:endpoint
wsdlLocation="classpath:/Service.wsdl">
</jaxws:endpoint>
Note that the XML containing the "hidden" fields would no longer validate, so you would need to ignore those errors, if you are using schema validation on the input messages.
Upvotes: 1