Get JAX-WS to work with duplicate xsd:types

When writing a SOAP webservice using JAX-WS using NO explicit namespace declarations on the model and you have the following constellation: a webservice with a method named "order", a model class with the name "Order" the JAX-WS processor (e.g. Apache CXF) will complain because there are two XSD types referring to two different things. The webservice looks like this: <code>@WebService(...) public class WS { @WebMethod public void order(Order o); }</code> And the model like this: <code>@XmlRootElement public class Order { ... }</code> How can you work around this without using explicit namespace declarations and renaming the class or method?
1 answer


Add a @XmlType(name="model_order") annotation to the model class. This will generate two distinct XSD types without renaming the XSD element.
public class Order {