You use the wsimport command to generate Java API for XML Web Services (JAX-WS) portable artifacts.
Synopsis
wsimport [ options ] wsdl_URI
optionsThis represents the wsimport command-line options. See Options for the wsimport Command.
wsdl_URIThe file that contains the machine-readable description of how the web service can be called, what parameters it expects, and what data structures it returns.
Description
The wsimport command generates the following JAX-WS portable artifacts. These artifacts can be packaged in a WAR file with the Web Services Description Language (WSDL) file and schema documents and the endpoint implementation to be deployed. The wsimport command also provides a wsimport Ant task.
Service Endpoint Interface (SEI)
Service
Exception class is mapped from wsdl:fault (if any)
Async Response Bean is derived from response wsdl:message (if any)
Java Architecture for XML Binding (JAXB) generated value types (mapped Java classes from schema types)
To start the wsgen command, enter the following commands:
Oracle Solaris/Linux:
/bin/wsimport.sh -help
Windows:
\bin\wsimport.bat -help
Options for the wsimport Command
-b pathSpecifies external JAX-WS or JAXB binding files. Multiple JAX-WS and Java Architecture for XML Binding (JAXB) binding files can be specified with the -b option. You can use these files to customize package names, bean names, and so on.
-B jaxbOptionPasses the jaxbOption option to the JAXB schema compiler.
-catalog fileSpecifies a catalog file to resolve external entity references. The -catalog option supports the TR9401, XCatalog, and OASIS XML Catalog formats.
-classpath path or -cp pathSpecifies where to find user class files and wsimport extensions.
-d directorySpecifies where to place generated output files.
-encoding encodingSpecifies the character encoding used by the source files.
-extensionAllows vendor extensions. Use of extensions can result in applications that aren’t portable or that don’t work with other implementations.
-helpDisplays a help message for the wsimport command.
-httpproxy:proxySpecifies an HTTP proxy server. The format is:
[user[:password]@]proxyHost:proxyPort
-JjavacOptionPasses this option to javac.
-keepKeeps generated files.
-p nameSpecifies a target package name to override the WSDL file and schema binding customizations, and the default algorithm defined in the specification.
—m nameGenerates module-info.java with the given Java module name.
-quietSuppresses the wsimport command output.
-s directorySpecifies where to place generated source files.
-target versionGenerates code according to the specified JAX-WS specification version. Version 2.0 generates compliant code for the JAX-WS 2.0 specification.
-verboseDisplays compiler messages.
-versionPrints version information.
-fullversionPrints full version information.
-wsdllocation locationSpecifies the @WebServiceClient.wsdlLocation value.
-clientjar jarfileCreates the jar file of the generated artifacts along with the WSDL metadata required for invoking the web service.
-generateJWSGenerates a stubbed Java Web Start (JWS) implementation file.
-implDestDir directorySpecifies where to generate the JWS implementation file.
-implServiceName nameSpecifies the local portion of service name for generated JWS implementations.
-implPortName nameSpecifies the local portion of the port name for generated JWS implementations.
Multiple JAX-WS and JAXB binding files can be specified using the -b option, and they can be used to customize various things such as package names and bean names.
Extensions for the wsimport Command
-XadditionalHeadersMaps headers not bound to a request or response message to Java method parameters.
-Xauthfile fileSpecifies the WSDL URI that identifies the file that contains authorization information. This URI is in the following format:
http://user-name:password@host-name/web-service-name>?wsdl.
-XdebugPrints debugging information.
-Xno-addressing-databindingEnables binding of W3C EndpointReferenceType to Java.
-XnocompileDoesn’t compile the generated Java files.
-XdisableAuthenticatorDisables Authenticator used by the JAX-WS reference implementation. -Xauthfile option will be ignored if set.
-XdisableSSLHostnameVerificationDisables the SSL Hostname verification while fetching wsdl files.
Examples
The following are examples of using the wsimport command:
wsimport stock.wsdl -b stock.xml -b stock.xjb
wsimport -d generated http://example.org/stock?wsdl