6

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

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
zmeda
  • 2,909
  • 9
  • 36
  • 56

1 Answers1

2

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.

Joachim Sauer
  • 302,674
  • 57
  • 556
  • 614
  • If I understand this right I need to change WSDL file and insert above sample into WSDL file? Or can I create external binding file to transform it to proper class? Example pls – zmeda Jun 01 '11 at 09:27
  • Changing the WSDL is **one** way. Examples for specifying external configuration are found in the documentation I linked to. – Joachim Sauer Jun 01 '11 at 09:28