JAX-WS: Working with .NET Web Services
Join the DZone community and get the full member experience.Join For Free
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′.
Published at DZone with permission of Yohan Liyanage, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.