Last Modified: 06/07/05
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.
wsimport [options] <wsdl>
The following table lists the wsimport
options.
Table 1-1 wsimport Options
Option |
Description |
---|---|
|
Specify where to place generated output files |
|
Specify external JAX-WS or JAXB binding files (Each |
|
Display help |
|
Specify an HTTP proxy server (port defaults to 8080) |
|
Keep generated files |
|
Specify where to place generated source files |
|
Output messages about what the compiler is doing |
|
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.
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 |
|
Forks the |
n/a |
|
Arguments to pass to the forked virtual machine |
n/a |
|
WSDL file |
WSDL |
|
Specify where to place output generated classes |
|
|
Specify an HTTP proxy server (port defaults to 8080) |
|
|
Specify where to place generated source files |
|
|
Keep generated files |
|
|
Output messages about what the compiler is doing |
|
|
Specify external JAX-WS or JAXB binding files |
|
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..
<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.