I\'m trying to generate a client for some SOAP web services using the JDK 6 tool wsimport
.
The WSDL was generated by a .NET 2.0 application. For .NET 3.X applicatio
You are possibly generating all the classes from the WSDL file in the same package. If that is the case, try specifying a different target package for each WSDL file with the -p option of wsimport.
I don't know if this was ever solved, but I spent some time googling for a solution to this same problem.
I found a fix here - https://jax-ws.dev.java.net/issues/show_bug.cgi?id=228
The solution is to run wsimport with the -B-XautoNameResolution
(no spaces)
For anyone reading this using maven, this is how to add it to the .pom file. Note the args in the configuration section. This is not very easily found in documentation. Many thanks to Isaac Stephens for his help with this.
<!-- definition for ERPStandardWork service -->
<execution>
<id>ERPStandardWorkService</id>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<!-- this resolves naming conflicts within the wsdl - there are several copies of fault report objects which clash otherwise. -->
<args>
<arg>-B-XautoNameResolution</arg>
</args>
<wsdlDirectory>${basedir}/src/main/resources/META-INF/wsdl</wsdlDirectory>
<wsdlFiles>
<wsdlFile>ERPStandardWork.wsdl</wsdlFile>
</wsdlFiles>
<wsdlLocation>${basedir}/src/main/resources/META-INF/wsdl/ERPStandardWork.wsdl
</wsdlLocation>
<staleFile>${project.build.directory}/jaxws/ERPStandardWork/.staleFlag
</staleFile>
</configuration>
</execution>
The accepted answer above would solve your problem but wouldnt fix the underlying cause.
The issue is happening because an operation in your wsdl file has the same name as an xsd:complexType in your xsd file - like the example below. All types and operations should have unique names.
<xsd:complexType name="SearchDocuments">
<xsd:sequence>
<xsd:element name="document" type="ns0:SearchDocumentById" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<operation name="SearchDocuments">
<input wsam:Action="http://controller.xxx.xxx.com/DocumentWS/searchDocumentsRequest" message="tns:searchDocumentsRequest"/>
<output wsam:Action="http://controller.xxx.xxx.com/DocumentWS/searchDocumentsResponse" message="tns:searchDocumentsResponse"/>
</operation>
So check your operations and types. Make sure none of them have the same name i.e. no duplicate names.