Over a million developers have joined DZone.

JAX-WS: Working with .NET Web Services

· Java Zone

Discover how AppDynamics steps in to upgrade your performance game and prevent your enterprise from these top 10 Java performance problems, brought to you in partnership with AppDynamics.

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′.

The Java Zone is brought to you in partnership with AppDynamics. AppDynamics helps you gain the fundamentals behind application performance, and implement best practices so you can proactively analyze and act on performance problems as they arise, and more specifically with your Java applications. Start a Free Trial.

Topics:

Published at DZone with permission of Yohan Liyanage, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}