9

How do I customize the packages of the namespaces when using jax-ws to generate the java artifacts.

I'm running jax-ws iwsmport via maven.

I don't want to change the default package, I want to be able to map from more than one namespace to different packages.

Michael Wiles
  • 20,902
  • 18
  • 71
  • 101

1 Answers1

11
<jaxb:bindings 
            schemaLocation="../../wscontract/src/main/resources/wsdl/address.xsd"
    node="//xsd:schema[@targetNamespace='http://demo.iae.ws/address']">
    <jaxb:schemaBindings>
        <jaxb:package name="demo.ws.address" />
        <jaxb:nameXmlTransform>
            <jaxb:typeName prefix="Customer" />
        </jaxb:nameXmlTransform>
    </jaxb:schemaBindings>
</jaxb:bindings>

Use JAXB bindings with the wsimport -b switch. You can find some sample files here.

McDowell
  • 107,573
  • 31
  • 204
  • 267
  • and then I can reference multiple of these binding files? – Michael Wiles Jun 02 '11 at 13:06
  • @Michael Wiles - you can pass more than one binding file with multiple `-b` switches. It should also possible to [add JAXB instructions to your schemas](http://download.oracle.com/docs/cd/E17802_01/webservices/webservices/docs/2.0/tutorial/doc/JAXBUsing4.html#wp148975) if you prefer that approach. – McDowell Jun 02 '11 at 13:13
  • and you can also include multiple of these jaxb:bindings in the one bindings file as well as far as I can tell – Michael Wiles Jun 02 '11 at 13:21
  • @Michael Wiles - yes, you can bind any number of schemas from one binding file. – McDowell Jun 02 '11 at 13:40