Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java wsimport rename/different ObjectFactory.java

I'm having problem with wsimport. In one of my wsdl which has to be wsimported I have a complexType with name "objectFactory". Is there any way to tell command wsimport to create while importing different class for maintaining JAXB connections such is ObjectFactory.java. In other words can I tell wsimport instead of creating ObjectFactory.java some custom class like MyCustomFactory.java?

Is it possible to customize mapping in such a way that complexType name="objectFactory" would map to object with different name like MyObjectFactory.java?

Thx

like image 509
zmeda Avatar asked May 30 '11 13:05

zmeda


1 Answers

JAX-WS (of which wsimport is a part) uses JAXB for generating the XML binding files (and for doing the actual binding). So you'll want to check out this documentation on customizing JAXB bindings. It applies just as well to your case.

In your case you'd use something like this:

<xsd:complexType name="objectFactory">
  <xsd:annotation>
  <xsd:appinfo>
     <jxb:class name="MyObjectFactory" />
  </xsd:appinfo>
  </xsd:annotation>
  <!-- ... rest of your specification ... ->
</xsd:complexType>

This example is for inline customization in your XML Schema/WSDL. You can also provide this information as external configuration.

like image 96
Joachim Sauer Avatar answered Oct 01 '22 00:10

Joachim Sauer