Running wsdlc on a wsdl... Using type=JAXWS. Works fine without a package name... The default will be used from namespace.
However when i specify packageName getting a long stream of errors regarding class collisions for xsd generated classes!
I know that there are multiple imports for same xsd schema in various files, but could not find a solution for this, and seems basic enough to be previously encountered by others.
[wsdlc] [ERROR] A class/interface with the same name "MyClass" is already in use. Use a class customization to resolve this conflict.
that's the option i was using!
I realize what is happening, but still dont have a good answer... The error is valid!
When importing the xsd schema files there are duplicates due to versions, in name spaces like: v1/Service and v2/Service...
Without packageName option the xsd corresponding Java classes are created in different packages: v1.Service and v2.Service... When i specify package name they all try to come under "myPackageName" and of course there would be a conflict... What i want, i guess, is to generate the schema classes with name space package and only the SEI and SIB Java classes under a specific package name!?
one extra comment here... the legitimate collision issue due to multiple schema version for same "class" is only apparent in JAXWS! Same wsdlc taks with JAXRPC works fine generating package from xsd name space.
It is clear that the direction to control package names is using binding file, but not sure if wsdlc supports that...
actually looking at the link you sent found the explanation for my initial error!
The way wsdlc/packageName is used between JAX-RPC vs JAX-WS is completely different!!
With second option all classes will end-up with same package name, which is why did not see the collision with first one.
For me the difference looks fairly drastic, surprised there is not an option just to generate the same way...
Here's the actual documentation:
Depending on the type of partial implementation you generate (JAX-WS or JAX-RPC), the Java package name of the generated complex data types differs, as described in the following guidelines:
• For JAX-WS, if you specify the packageName attribute, then all artifacts (Java complex data types, JWS interface, and the JWS interface implementation) are generated into this package. If you want to change the package name of the generated Java complex data types in this case, use the <binding> child element of the wsdlc Ant task to specify a custom binding declarations file. For information about creating a custom binding declarations file, see "Using JAXB Data Binding" in Getting Started With JAX-WS Web Services for Oracle WebLogic Server.
• For JAX-RPC, if you specify the packageName attribute of the wsdlc Ant task, only the generated JWS interface and implementation are in this package. The package name of the generated Java complex data types, however, always corresponds to the XSD Schema type namespace, whether you specify the packageName attribute or not.