1. wsimport
The wsimport tool is for the JAX-WS web service. It creates client-side Java stub source files and server-side web service interface Java source files from the WSDL file. wsimport also creates web service policy configuration files.
wsimport creates the following from the WSDL file.
-
SEI, service classes, and other JAXB related Java classes
-
wsit-client.xml file and the WSDL file that includes the web service policy settings
The following describes how to use the tool and parameters.
-
Usage
Usage: wsimport [options] <WSDL_URI> where [options] include: -b <path> specify jaxws/jaxb binding files or additional schemas (Each <path> must have its own -b) -B <jaxbOption> Pass this option to JAXB schema compiler -catalog <file> specify catalog file to resolve external entity references supports TR9401, XCatalog, and OASIS XML Catalog format -d <directory> specify where to place generated output files -extension allow vendor extensions - functionality not specified by the specification. Use of extensions may result in applications that are not portable or may not interoperate with other implementations -help display help -httpproxy:<host>:<port> specify a HTTP proxy server (port defaults to 8080) -keep keep generated files -p <pkg> specifies the target package -quiet suppress wsimport output -s <directory> specify where to place generated source files -target <version> generate code as per the given JAXWS spec version Defaults to 2.2, Accepted values are 2.0, 2.1 and 2.2 e.g. 2.0 will generate compliant code for JAXWS 2.0 spec -verbose output messages about what the compiler is doing -version print version information -wsdllocation <location> @WebServiceClient.wsdlLocation value -clientjar <jarfile> Creates the jar file of the generated artifacts along with the WSDL metadata required for invoking the web service. -generateJWS generate stubbed JWS implementation file -implDestDir <directory> specify where to generate JWS implementation file -implServiceName <name> local portion of service name for generated JWS implementation -implPortName <name> local portion of port name for generated JWS implementation Extensions: -XadditionalHeaders map headers not bound to request or response message to Java method parameters -Xauthfile file to carry authorization information in the format http://username:password@example.org/stock?wsdl -Xdebug print debug information -Xno-addressing-databinding enable binding of W3C EndpointReferenceType to Java -Xnocompile do not compile generated Java files -XdisableAuthenticator disable Authenticator used by JAX-WS RI, -Xauthfile option will be ignored if set -XdisableSSLHostnameVerification disable the SSL Hostname verification while fetching wsdls Examples: wsimport stock.wsdl -b stock.xml -b stock.xjb wsimport -d generated http://example.org/stock?wsdl
-
Parameters
Parameter Description -b <path>
External JAX-WS or JAXB binding files.
-B <jaxbOption>
Specifies to pass this option to the JAXB schema compiler.
-catalog <file>
Sets the external entity reference values such as the TR9401, XCatalog, and OASIS XML Catalog types. The ant xmlcatalog type can also be used.
-d <directory>
Result files directory.
-extension
Allows vendor extensions. This option may cause compatibility and portability issues.
-help
Displays help.
-httpproxy:<host>:<port>
HTTP proxy server. (Default value: 8080)
-keep
Keeps created files.
-p <pkg>
Java package names for all Namespace URIs defined in WSDL.
quiet
Prevents output messages from being displayed.
-s <directory>
Source files directory. If this property is set, the keep property is automatically set.
-target <version>
Creates code according to the specified version of JAX-WS specifications.
-verbose
Displays verbose messages. (Default value: false)
-version
Displays version information.
-wsdllocation <location>
If WSDL URI is set in this property, it applies to service end-point interfaces and @WebServiceClient.wsdlLocation and @WebService.wsdlLocation annotations of the service interfaces.
-clientjar <jarfile>
Generates a jar file of the artifact created along with a WSDL meta data that is required to call a web service.
-generateJWS
Generates a stubbed JWS implementation file.
-implDestDir <directory>
Location where a JWS implementation file will be generated.
-implServiceName <name>
Local part of the service name for generated JWS implementation.
-implPortName <name>
Local part of the port name for generated JWS implementation.
-
Example
wsimport is a general script file located in JEUS_HOME/bin/.
The following is an example of executing wsimport.
$ wsimport -d build/classes -keep -p fromwsdl.server src/conf/AddNumbers.wsdl
The previous command created a portable artifact with a package name of fromwsdl.server from AddNumbers.wsdl. Java class source files created by the [-keep] option are not deleted.