1

I'm trying to use JAXB2 2.2 to generate sources from WSDL files. The WSDL files come from a third party and they all define the same common types in addition to a type specific to that WSDL. If I have only one WSDL in the source folder (let's call it A.wsdl), everything works great and the generated sources look like:

A.java
X.java
Y.java

If I clear the output dir and generate with only B.wsdl I get

B.java
X.java
Y.java

I want to be able to put both WSDLs in the source and get

A.java
B.java
X.java
Y.java

I don't care which wsdl X and Y come from, they are identical for all of them. Currently JAXB2 throws org.xml.sax.SAXParseException: 'X' is already defined and generates nothing. I went through the help output but didn't find any config options that seemed like they would help.

Egor
  • 1,622
  • 12
  • 26
  • Why are you generating the classes inside the same package? This can't work. What if `X` from WSDL1 and `X` from WSDL2 aren't the same? Also, please post exactly the command you are using or Maven configuration. – Tunaki Mar 11 '16 at 21:33
  • Also very related http://stackoverflow.com/questions/26274407/prevent-generation-of-duplicate-classes-from-xsds-without-namespaces – Tunaki Mar 11 '16 at 21:40
  • @Tunaki I'm running `mvn jaxb2:xjc` X is the same for both WSDLs in my business case. I'm basically looking for some way to just tell JAXB to ignore or overwrite duplicates. – Egor Mar 11 '16 at 21:44
  • Oh, and my config is very barebone ` src/main/wsdl/ wsdl` – Egor Mar 11 '16 at 21:45
  • Have you looked at the linked question? It was answered by the developer of the library himself. – Tunaki Mar 11 '16 at 21:46
  • I did, but he clearly says "this isn't an answer to your question" in the first and last lines of his answer. I'll try his binding suggestion, although it's unfortunate that I have to spell out every duplicate class instead of just telling JAXB to ignore any dupes it runs across. – Egor Mar 11 '16 at 21:50

0 Answers0