When generating the Java classes using wsgen from a WSDL I was getting the following error:
Two classes have the same XML type name "{http://myservice/}foo". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
As suggested by the exception I tried changing @XmlType but that was fine for me.
This link offers the same solution and it also suggests to change Response classes which I think its an extreme solution.
Anyway in my case the problem was that I generated the classes and I wanted to change the package name.
Everything worked fine, compiled and the webservice deployed successfully.
When viewing the WSDL I got the above error.
In my case the solution was just to update the new namespace in the Webmethod attribute.
@WebMethod
@WebResult(targetNamespace = "")
@RequestWrapper(localName = "foo", targetNamespace = "http://fooservice/", className = "com.foo.service.generated.foo")
@ResponseWrapper(localName = "fooResponse", targetNamespace = "http://fooservice/", className = "com.foo.service.generated.FooResponse")
The attribute className had to be updated :(
Subscribe to:
Post Comments (Atom)
Very good! Thank you! Brazil.
ReplyDeleteAhh, thank you. After hours of trying to debug your post pointed me back to the (obvious) problem that I had moved the generated .java files into a sub-folder and therefore needed to change the className attribute!
ReplyDeleteThank you!
i have the same problem in my case, you changed className in @RequestWrapper or @ResponseWrapper ?
ReplyDeleteobject factory must be changed ?