JAX-WS 2.0 Early Access  - wsimport


Last Modified: 06/07/05

wsimport

The wsimport tool generates JAX-WS portable artifacts, such as:

These artifacts can be packaged in a WAR file with the WSDL and schema documents along with the endpoint implementation to be deployed.

Command-line

Syntax

wsimport [options] <wsdl>

The following table lists the wsimport options.

Table 1-1 wsimport Options

Option

Description

-d <directory>

Specify where to place generated output files

-b <path>

Specify external JAX-WS or JAXB binding files (Each <file> must have its own -b)

-help

Display help

-httpproxy:<host>:<port>

Specify an HTTP proxy server (port defaults to 8080)

-keep

Keep generated files

-s <directory>

Specify where to place generated source files

-verbose

Output messages about what the compiler is doing

-version

Print version information

Multiple JAX-WS and JAXB binding files can be specified using -b option and they can be used to customize various things like package names, bean names, etc. More information on JAX-WS and JAXB binding files can be found in the customization documentation.

Ant task

An Ant task for the wsimport tool is provided along with the tool. The attributes and elements supported by the Ant task are listed below:

  <wsimport
fork= "true|false"
jvmargs="..."
wsdlFile="..."
base="directory for generated class files"
HTTPProxy="proxy host and port"
sourceBase="directory for generated source files"
keep="true|false"
verbose="true|false"
version="true|false"
<binding dir="..." includes="..." />
</wsimport>


Attribute

Description

Command line

fork

Forks the wsimport process into another virtual machine

n/a

jvmargs

Arguments to pass to the forked virtual machine

n/a

wsdlFile

WSDL file

WSDL

base

Specify where to place output generated classes

-d

HTTPProxy

Specify an HTTP proxy server (port defaults to 8080)

-httpproxy

sourceBase

Specify where to place generated source files

-s

keep

Keep generated files

-keep

verbose

Output messages about what the compiler is doing

-verbose

binding

Specify external JAX-WS or JAXB binding files

-b

The binding attributes is like a path-like structure and can also be set via nested <binding> elements, respectively. Before this task can be used, a <taskdef> element needs to be added to the project as given below:

  <taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
<classpath path="jaxws.classpath"/>
</taskdef>

where jaxws.classpath is a reference to a path-like structure, defined elsewhere in the build environment, and contains the list of classes required by the JAX-WS tools..

Examples

  <wsimport
base="${build.classes.home}"
debug="true"
wsdlFile="AddNumbers.wsdl"
binding="custom.xml"/>


The above example generates client-side artifacts for AddNumbers.wsdl, stores .class files in the ${build.classes.home} directory using the custom.xml customization file. The classpath used is xyz.jar and compiles with debug information on.

  <wsimport
keep="true"
sourceBase="${source.dir}"
base="${build.classes.home}"
wsdlFile="AddNumbers.wsdl">
<binding dir="${basedir}/etc" includes="custom.xml"/>
</wsimport>


The above example generates portable artifacts for AddNumbers.wsdl, stores .java files in the ${source.dir} directory, stores .class files in the ${build.classes.home} directory.


Copyright © 2005 Sun Microsystems, Inc. All rights reserved.