[JAX-WS] (Metro) 3 ways to customize package in WSDL

By default wscompile generates WSDL artifacts in a package computed from the WSDL targetNamespace. For example, a WSDL file with the targetNamespace http://duke.example.org without any package customization will be mapped to the org.duke package. To customize the default package mapping you would use a jaxws:package customization on the wsdl:definitions node or it can directly appear inside the top level bindings element.

1. Bindings

<bindings xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        wsdlLocation="http://localhost:8080/jaxws-external-customize/addnumbers?WSDL"
        xmlns="http://java.sun.com/xml/ns/jaxws">
    <package name="external_customize.client">
        <javadoc>Mathutil package</javadoc>
    </package>
</bindings>

2. Bindings / bindings

<bindings xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
        wsdlLocation="http://localhost:8080/jaxws-external-customize/addnumbers?WSDL"
        xmlns="http://java.sun.com/xml/ns/jaxws">
    <bindings node="wsdl:definitions">
        <package name="external_customize.client">
            <javadoc>Mathutil package</javadoc>
        </package>
        
        ...
        
    </bindings>
    
    ...
    
</bindings>

3. By using the -p command line option in wsimport
-p option on commandline wsimport.sh tool (package attribute on wsimport ant task), overrides the jaxws:package customization,it also overrides the schema package customization specified using jaxb schema customization.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s