Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Use a class customization to resolve this conflict Error and JAXWS  RSS feed

 
Ong Vua
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm generating a WS proxy from an existing wsdl. Below is my code in an ant build script

<taskdef name="clientgen" classname="weblogic.wsee.tools.anttasks.ClientGenTask"/>

<target name="generate-build">
<clientgen type="JAXWS"
wsdl="C:\e900\DV900\java\TEST\integrationevent.wsdl"
destDir="C:\e900\DV900\java\TEST\output"
packageName="com.abc"/>
</target>

This wsdl file references 2 external xsd files and these xsd files reside in the same directory as the wsdl file.

I got the below error. Do you have any ideas?

I'm using jdk160_14_R27.6.5-32, weblogic 10.3.2, jdeveloper 11.1.1.2

[clientgen] Consider using <depends>/<produces> so that wsimport won't do unnecessary compilation
[clientgen] parsing WSDL...
[clientgen]
[clientgen]
[clientgen] [ERROR] A class/interface with the same name "com.abc.ListOfOpportunity" is already in use. Use a class customization to resolve this conflict.
[clientgen] line 1 of file:/C:/e900/DV900/java/TEST/Contact.xsd
[clientgen]
[clientgen] [ERROR] (Relevant to above error) another "ListOfOpportunity" is generated from here.
[clientgen] line 1 of file:/C:/e900/DV900/java/TEST/Opportunity.xsd
[clientgen]
[clientgen] [ERROR] A class/interface with the same name "com.abc.Book" is already in use. Use a class customization to resolve this conflict.
[clientgen] line 1 of file:/C:/e900/DV900/java/TEST/Contact.xsd
[clientgen]
[clientgen] [ERROR] (Relevant to above error) another "Book" is generated from here.
[clientgen] line 1 of file:/C:/e900/DV900/java/TEST/Opportunity.xsd
[clientgen]
[clientgen] [ERROR] A class/interface with the same name "com.abc.ListOfContact" is already in use. Use a class customization to resolve this conflict.
[clientgen] line 1 of file:/C:/e900/DV900/java/TEST/Contact.xsd
[clientgen]
[clientgen] [ERROR] (Relevant to above error) another "ListOfContact" is generated from here.
[clientgen] line 1 of file:/C:/e900/DV900/java/TEST/Opportunity.xsd
[clientgen]
[clientgen] [ERROR] A class/interface with the same name "com.abc.Attachment" is already in use. Use a class customization to resolve this conflict.
[clientgen] line 1 of file:/C:/e900/DV900/java/TEST/Contact.xsd
[clientgen]
[clientgen] [ERROR] (Relevant to above error) another "Attachment" is generated from here.
[clientgen] line 1 of file:/C:/e900/DV900/java/TEST/Opportunity.xsd
[clientgen]
[clientgen] [ERROR] A class/interface with the same name "com.abc.SiebelXmlAttachmentType" is already in use. Use a class customization to resolve this conflict.
[clientgen] line 1 of file:/C:/e900/DV900/java/TEST/Contact.xsd
[clientgen]
...etc.



 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
You have an entity with the same name, residing in namespaces with the same name (the same namespace?), in two different XML schemas.
For instance, you have the Book entity/type in both the Contact.xsd and Opportunity.xsd schemas.
Are these types identical or different? If identical, then a suggestion is to refactor your XML schemas.
If not identical, then perhaps change the namespaces so that Book in Contact.xsd resides in a different namespace than Book in Opportunity.xsd.
There are additional measures as well.
Best wishes!
 
Deepeentee Jhoomuck
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

In the case, you don't have permission to modify WSDL or XSD. You can always add the following code snippet in your bindings.xml so as to do the class customization. This code will add any suffix you want to the class names of the classes generated.

<?xml version="1.0" encoding="UTF-8"?>
<jaxws:bindings wsdlLocation="WSDL_ENDPOINT?wsdl" //Insert your WSDL link here
                xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
                xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" version="2.0"
                xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <jaxws:bindings node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='TARGET_NAMESPACE']">//Insert your targetNamespace
        <jaxb:schemaBindings>
            <jaxb:nameXmlTransform>
                <jaxb:elementName suffix="Elem"/> //here the suffix is Elem
            </jaxb:nameXmlTransform>
        </jaxb:schemaBindings>
    </jaxws:bindings>
</jaxws:bindings>

Hopes this help!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!