JAX-WS: Working with .NET Web Services
If you happen to write a JAX-WS Web Services client for a service which is written using .NET Platform, you might come across the below error message when you execute wsimport command.
A class/interface with the same name “?????” is already in use. Use a class customization to resolve this conflict.
This happens because .NET generated WSDL documents may contain multiple elements with same name, which leads to a naming conflict when JAXB attempts to generate bindings. If you ever come across this situation, the solution is very simple. You just have to instruct the JAXB generator to automatically resolve any naming conflicts that might occur during the code generation. This can be done by providing -B-XautoNameResolution argument to wsimport tool. Note that the ‘-B-XautoNameResolution’ has no spaces. -B is used to pass instructions to JAXB Schema Compiler.
An example would be:
wsimport -d gen-src -verbose -B-XautoNameResolution https://sample.net/service.asmx?WSDL
Note that generated code will refer to duplicate names with a numeric suffix. For example, if there are two elements with name ‘XYZ’, one class will be ‘XYZ’, and the other occurrence will be named as ‘XYZ2′.