Deployment Tools  Locate

Deployment Tools Introduction  Locate

Remote deployment and undeployment of Web services is conducted with two separate command-line tools: Deploy and Undeploy, respectively. They are included in the Core-Tools component (please see the Components chapter), although the scripts for running them are found in the %WASP_HOME/bin directory.

Either a single class or a complete deployment package may be deployed. A deployment package may be either a server package or a client package. It includes a deployment descriptor (the only required content) and any number of services, libraries and files. This package can be generated by WaspPackager.

WaspPackager  Locate

Overview  Locate

If you want to create a ready-to-deploy JAR file, you can easily do so with the WaspPackager tool. It generates the deployment descriptor and all the necessary files for a deployed service and packs them into the specified JAR.

WaspPackager can generate server packages and client packages. Any number of services may be included in a package. You can add your own libraries and files and use your own WSDL files and deployment descriptor.

The only file that must be included in a package is the deployment descriptor; all others are optional. In principal, a package could consist of only the deployment descriptor and nothing else.

WaspPackager is included in the Core-Tools component. It is accessible through the WaspPackager script in the bin subdirectory of the WSO2 SOA Enablement Server distribution.

[Note]Note

Instead of manually typing out the command line each time you run WaspPackager, you can create an ANT task build script that can be reused. Please see ANT WaspPackager Task for details.

Guide to Switches  Locate

The only required parameters for the WaspPackager tool are the name of the generated package and the name of the output JAR file.

Server package creation:

WaspPackager --package package_name --output output_file
[--force] [option...]

Client package creation:

WaspPackager --client --package package_name --output output_file
[--force] [option...]

All parameters for the WaspPackager command are described in the following tables:

Table 24. Package Creation Switches

Switch --full name Switch -abbreviation ValueDescription
--package -p package_nameName of generated package.
--client N/AN/ACommand to generate client-side package.
--output -o output_fileOutput file (JAR). Fully qualified name.
--force -f N/ACommand to overwrite output file without asking for confirmation.
--validate-messages N/Anone (default value, validation is switched off), 'inout', 'in', 'out' Validate messages against XML schema in specified direction (also possible to set for individual service, see Table 27, “Options for Adding New Services to the Package”)

Table 25. Options for Including Classes in the Package

Switch --full nameSwitch -abbreviation Value Description
--classpath -s dirDirectory with classes to pack (all files from dir will be packed) (it can be list separated with path separator).

Table 26. Options for the --classpath Switch

Option --full name ValueDescription
--include maskIncludes files with given filename mask (default value: '*').
--exclude maskExcludes files with given filename mask (default value: '""').

Table 27. Options for Adding New Services to the Package

Option --full nameOption -abbreviation ValueDescription
--attachment-type N/AtypeSets whether attachments will be MIME ("mime") or DIME ("dime"). Default value is read from WSO2 SOA Enablement Server configuration.
--service-name -n nameName for the packed service in WSO2 SOA Enablement Server.
--class -c <Class>Fully qualified Java class name.
--generate-wsdl N/A true/false Sets whether the WSDL file for the service should be generated and included into the package. Default value is "true."
--uri -u /pathService path on server, preceded by forward slash (/).
--validate-messages dirN/Anone (default value, validation is switched off), 'inout', 'in', 'out' Validate messages for a service against XML schema in specified direction (also possible to set for entire package, see Table 24, “Package Creation Switches”)
--wsdl-file -w fileWSDL file provided by yourself.
--wsdl-service -v nameName of the service in WSDL file.
--soap-binding-style --sbs styleSOAP binding style ("document" (default), "rpc" or "wrapped"). Default value is read from WSO2 SOA Enablement Server configuration.
--soap-encoding-style --ses styleSOAP encoding style ("literal" or "encoded"). Default value is read from WSO2 SOA Enablement Server configuration.
--protocol N/AprotocolSOAP protocol version: 1.1, 1.2 or both ("soap11," "soap12" or "soap11,soap12"). Default is 1.1.

Table 28. Options for Adding Additional Files and Directories into Package

Option --full nameOption -abbreviationValueDescription
--add -a file_or_dirAdds file or directory to package
--prefix -x pathPrefix (path) of the added directory or file in the generated package (optional)
--lib -l lib_fileAdds file (JAR) to "lib" directory

Table 29. Options for Adding Your Own Deployment Descriptor

Option --full name Option -abbreviation ValueDescription
--deployment-descriptor -dd fileDeployment descriptor made by yourself
--generate-wsdl-dd -g N/AGenerate WSDL for services in descriptor
--wsdl-file -w wsdl_fileWSDL file made by yourself.
--classpath -s dirDirectory with classes (classpath, can be list separated with path separators)
--soap-binding-style --sbs styleSOAP binding style ("document" (default), "rpc" or "wrapped"). Default value is read from WSO2 SOA Enablement Server configuration.
--soap-encoding-style --ses styleSOAP encoding style ("literal" or "encoded"). Default value is read from WSO2 SOA Enablement Server configuration.
--protocol N/AN/ASOAP protocol version: 1.1, 1.2 or both ("soap11," "soap12" or "soap11,soap12"). Default value is read from WSO2 SOA Enablement Server configuration.
--validate N/Atrue/falseIf true, deployment descriptor will be validated against xml schema. Default value is true. Only descriptors with targetNamespace=" http://systinet.com/wasp/package/1.2 " are validated. Location of XML schema is read from WSO2 SOA Enablement Server configuration.

Table 30. Options for Defining Package Parameters

Option --full name ValueDescription
--tns namespaceTarget namespace of the generated package (default: 'http://my.org')
--package-version versionVersion of this package (default: '1.0')
--library N/ASets this package as a shared library package (default: false)
--license uriURI of the license (default: 'http://my.org')
--depends qNameSets that this package depends on the package specified by its qualified name
--min-version version_numberMinimum version of the specified package

Table 31. Other Options

Option --full name ValueDescription
--verbose0-2

"0": show error message

"1": show error message including line and column number

"2": same as "1" and print stack trace

--help N/APrints list of these options to screen
--version N/APrint versions of this tool and WSO2 SOA Enablement Server for Java

Table 32. Special Options for Client Packages

Switch --full name Description
--dd Deployment descriptor
--classpath Class directory (where to look for classes to pack)
--lib This package is a shared library (default=false)
--tns targetNamespacePackage target namespace (default=http://my.org)
--package-version Version of this package (default=1.0)
--license License of this package
Package Creation Usecases  Locate
Nothing Pregenerated - Generate Everything for Me  Locate

When nothing is pre-generated, the WaspPackager tool will generate the deployment descriptor and WSDL files for specified services. You can define any number of services on the command line. Since everything is generated with default values, this is one of the fastest methods to create a deployment package file.

[Note]Note

Once Web service class sources are available in the classpath, they are observed and parameter names are read from them and fed into WSDL.

The command-line options are explained in Table 24, “Package Creation Switches”, Table 25, “Options for Including Classes in the Package” and Table 27, “Options for Adding New Services to the Package”

The command in Example 194 packages the HelloService class when nothing has been pregenerated.

Example 194. WaspPackager with Nothing Pregenerated

WaspPackager --package MyPackage --output mypack.jar --service-name HelloService
--uri /HelloService --class demo.basic.hello.server.HelloService 
--classpath ../demo/basic/hello/build/server/classes
Pregenerated WSDL(s)  Locate

You may want to use your own WSDL as a definition of the service. In this case, simply specify this fact together with the service definition. Note that parameter names will not automatically be read from Web service class sources and fed into WSDL when you use your own WSDL.

The command-line options are explained in Table 24, “Package Creation Switches”, Table 25, “Options for Including Classes in the Package” and Table 27, “Options for Adding New Services to the Package”

The command line in Example 195 places HelloService into a package using a WSDL file provided by the user (HelloService.wsdl).

Example 195. WaspPackager with Pregenerated WSDL

WaspPackager --package MyPackage --output mypack.jar
--service-name HelloService --uri /HelloService --class demo.basic.hello.server.HelloService
--wsdl-file HelloService.wsdl --wsdl-service HelloService 
--classpath ../demo/basic/hello/build/server/classes
[Note]Note

If your WSDL contains only one Service element, it is retrieved by default, so you need not specify it on the command line.

Pregenerated Deployment Descriptor  Locate

You can provide WaspPackager with the location of a pregenerated deployment descriptor (dd) file with the command:

The full list of options for adding a pregenerated deployment descriptor is given in Table 29, “Options for Adding Your Own Deployment Descriptor”.

If a service is defined on the command line, the dd is updated accordingly.

The command in Example 196 includes the HelloService into a package using an existing deployment descriptor.

Example 196. WaspPackager with Pregenerated Deployment Descriptor

WaspPackager --package MyPackage --output mypack.jar
--dd mydesc.xml --classpath classes

The command in Example 197 packages the same service when the service definition is not included in the dd file.

Example 197. WaspPackager with Pregenerated Deployment Descriptor Without Service Definition

WaspPackager --package MyPackage --output mypack.jar
--service-name HelloService --uri /HelloService --class demo.HelloService --classpath classes
--dd mydesc.xml
Generating WSDL Files for Services with Deployment Descriptors  Locate

WSDL files can be generated for services that already have deployment descriptors (dd). The dd is updated accordingly after generating the WSDL. The options are almost the same as for generating a package with a pregenerated dd (please see Pregenerated Deployment Descriptor), except for one additional switch (-g).

The full list of options for adding a pregenerated deployment descriptor is given in Table 29, “Options for Adding Your Own Deployment Descriptor”.

The command in Example 198 generates a WSDL file based on a deployment descriptor called mydesc.

Example 198. WaspPackager Generating WSDL from Deployment Descriptor

WaspPackager --package MyPackage --output mypack.jar
--dd mydesc.xml --generate-wsdl-dd --classpath classes
Using Your Own WSDL and Deployment Descriptor Files  Locate

When using your own WSDL and deployment descriptor files for packaging, be sure that the WSDL files are specified after the --dd option.

The options for adding a pregenerated deployment descriptor and WSDL file are given in Table 24, “Package Creation Switches” and Table 29, “Options for Adding Your Own Deployment Descriptor”.

The command in Example 199 includes a service into the package MyPackage with a pregenerated deployment descriptor called mydesc.xml and a pregenerated WSDL file called mypack.wsdl.

Example 199. WaspPackager with Pregenerated WSDL and Deployment Descriptor

WaspPackager --package MyPackage --output mypack.jar
--dd mydesc.xml --wsdl-file mypack.wsdl
Package Parameters  Locate

You can specify all the important parameters of a deployment package using the options in Table 30, “Options for Defining Package Parameters”.

The command in Example 200 creates the package MyPackage with the HelloService, dependent on the class http://my.org:Debugger:

Example 200. Creating Package with Parameters

WaspPackager --package MyPackage --output mypack.jar
--service-name HelloService --class demo.HelloService --uri /HelloService
--classpath classes --depends http://my.org:Debugger --min-version 1.2.1
Adding Libraries and Other Files  Locate

Some Web services require special files and Java libraries to be packed with them. The relevant options are listed in Table 28, “Options for Adding Additional Files and Directories into Package”.

A file added using -a file can be accessed using getResource(java.lang.String) in org.systinet.wasp.webservice.ServiceInstance or getResourceAsStream(java.lang.String) in org.systinet.wasp.webservice.ServiceInstance.

Note on Document/Literal Support  Locate

All WSDL files generated by WaspPackager contain, by default, document binding and literal encoding styles. You can affect this behavior by using the --soap-binding-style and --soap-encoding-style parameters, described in Table 27, “Options for Adding New Services to the Package”.

The WSDL file generated by the command in Example 201 contains rpc binding and encoded encoding styles.

Example 201. Creating an rpc/encoded Service Package

WaspPackager --package MyPackage --output mypack.jar
--service-name HelloService --class demo.HelloService --uri /HelloService
--sbs rpc --ses encoded --classpath classes
Client Package Creation  Locate

Some Web services require special classes to be situated on the client side (header processors, serializers, etc.). WaspPackager can be used to create client packages which contain these classes. These packages should be put in the client classpath. The client package has a slightly different structure than the server package, as described in Client Package.

The command in Example 202 creates a client package with a pregenerated deployment descriptor.

Example 202. Creating a Client Package

WaspPackager --client --package MyClientPackage --output mypack.jar
--dd mydesc.xml --classpath classes

Deploy Tool  Locate

Overview  Locate

Remote deployment and undeployment of Web services is conducted by means of two separate command-line tools: Deploy and Undeploy, respectively. These tools are included in the Core-Tools component (see Components chapter), while the scripts for running them are found in the %WASP_HOME/bin directory.

The Deploy tool covers both deployment and redeployment. It is started from the %WASP_HOME/bin directory. Running Deploy from the command line without any parameters returns the help screen.

Either a single class or an entire package can be deployed.

Single Class Deployment  Locate

The Deploy tool provides 'one-button' deployment when you want to deploy a Web service that consists of a single class. You supply the Java class and service path on the host server. Deploy creates a temporary package and uses it to deploy the class to the server.

The only required parameters for deploying a single class are the full name of the service class and the service path, though it is recommended to specify the classpath of the source Java file as well. The procedure is described in Deploying Single Class to Server.

Procedure 4. Deploying Single Class to Server

  1. Type Deploy.

  2. You may specify the target server URL with --target URL ; otherwise, it will be http://localhost:6060.

  3. You may specify the target context (see Contexts); otherwise, it will be blank.

  4. You may have the service deployed in disabled mode by typing --disabled

  5. Type in any useful options that reproduce deployment descriptor parameters. All options are listed in Table 33, “Deployment Parameters”.

  6. Specify the service class with --class FULL_CLASSNAME

  7. Specify the service path with --uri /PATH. The path must begin with '/'.

  8. Specify the classpath of the source Java class with --classpath CLASSPATH. This is a recommended option; the default is the classpath set in your environment variables.

  9. Enter the command line.

The resulting command will resemble Example 203, which deploys the HelloService class.

Example 203. Deploying a Single Class

Deploy --class demo.basic.hello.server.HelloService --uri /HelloService

After this command is entered, HelloService is accessible from http://localhost:6060/HelloService, where /HelloService is its path.

Whole Package Deployment  Locate

Use whole package deployment when your Web service is contained in a JAR file. You supply the JAR file containing the package to be deployed, and the target url, as exhibited below. The JAR file that comprises the Web service package is created using WaspPackager, which is discussed in WaspPackager.

The only required parameters for whole package deployment are the full name of the package file and the URL of the target server, as described in Deploying Package to Server.

Procedure 5. Deploying Package to Server

  1. Type Deploy.

  2. You may specify the server URL with --target URL ; otherwise, it will be http://localhost:6060.

  3. You may specify the target context (see Contexts); otherwise, it will be blank.

  4. You may have the service deployed in disabled mode by typing --disabled

  5. Type in the qualified name of the JAR file containing the service.

  6. Enter the command line.

The command in Example 204 deploys the hello.jar package, created by WaspPackager and located at demo/basic/hello/server/classes.

Example 204. Deploying HelloService.jar

Deploy ../demo/basic/hello/server/classes/hello.jar

After this command is entered, HelloService is accessible from http://localhost:6060/HelloService.

Redeployment  Locate

Redeployment works exactly like deployment, with the addition of the --redeploy option. An existing package can be undeployed regardless of dependencies before redeployment with the --force option. Either single classes or whole packages may be redeployed.

The command in Example 205 redeploys the packages in the hello.jar file:

Example 205. Redeploying a Package

Deploy --redeploy ../demo/basic/hello/server/classes/hello.jar
Options for Deployment  Locate

Table 33. Deployment Parameters

Switch --full name / -abbreviationDescription Required/Optional

--target

-t

Server URL (default is http://localhost:6060)Optional

--context

-x

Context of the package to deploy (see Contexts)Optional
--disabled Deploys service in disabled modeOptional
For redeployment

--redeploy

-r

Specifies that this is a redeployment of a currently deployed service or packageRequired (for redeployment only)

--force

-f

Force undeployment regardless of dependencies before redeployingOptional
For deploying single-class only

--uri

-u

Service path, preceded by forward slash (/)Required

--class

-c

Full name of service classRequired

--classpath

-s

Sets classpath when deploying Java class (can also contain source Java file to obtain parameter names when creating WSDL) 

--package

-p

Name of generated package (qualified name (QName),default tns=http://my.org)Optional
--attachment-type Specifies attachment type: mime for MIME or dime for DIME. Default value is mime.Optional
--generate-wsdl=true/falseSets whether the WSDL should be generated and included into the package. Default is true. (If false, the WSDL is generated on the server during the installation of the package. Server default values for WSDL are used in this case).Optional

--soap-binding-style

--sbs

SOAP Binding style. Can be either rpc or document. Default value is read from WSO2 SOA Enablement Server configuration.Optional

--soap-encoding-style

--ses

SOAP Encoding style. Can be either literal or encoded. Default value is read from WSO2 SOA Enablement Server configuration.Optional
--protocol SOAP version protocol. The parameter values are soap11 for SOAP 1.1, soap12 for SOAP 1.2 or soap11 soap12 for both. The default value is read from WSO2 SOA Enablement Server configuration.Optional
See also Other Switches and Security Settings
Setting Contexts  Locate

Services are deployed to server_url/context/{tns}service_path. Usually the context is blank, so for example the HelloService may be deployed to http://localhost:6060/{http:my.org}HelloService. However, you can specify a context with the --context option. The command line in Example 206 will deploy the HelloService to http://localhost:6060/helloContext/{http:my.org}HelloService.

Example 206. Specifying Service Context

Deploy --context helloContext ../demo/basic/hello/server/classes/hello.jar

For more information on contexts, please see Contexts.

Binding/Encoding Style  Locate

WSDL files generated by Deploy contain a SOAP binding and encoding style. The default style is chosen during installation. You can override this default by using the following parameters:

--sbs style

SOAP binding style. Can be either rpc, document or wrapped. The default value is read from WSO2 SOA Enablement Server configuration files and it is set during the installation process to document.. See Standard Installation.

--ses style

SOAP encoding style. Can be either encoded or literal.

[Note]Note

The 'wrapped/literal' style is WS-I compliant but may cause backward compatibility issues with older clients. See WS-I Compliance for details.

The WSDL file generated by the command in Example 207 contains rpc binding and encoded encoding styles.

Example 207. Deploying a Class with RPC/Encoded Style

Deploy --class demo.basic.hello.server.HelloService --url /HelloService/
      --sbs rpc --ses encoded
Package Listing  Locate

You can retrieve a complete list of deployed packages from the server with either Deploy or Undeploy:

Deploy --list
Undeploy --list

By default, this command lists the packages deployed to http://localhost:6060. To list the packages deployed to another URL, use the --target URL option.

Other Switches  Locate

There exist a few other optional switches, mostly for providing information to the user. There is also a switch for disabling the validation of package deployment descriptors against the latest XML Schema.

Switch --full name/ -abbreviationDescription

--list

-l

List packages on server
--version Print version of this tool and WSO2 SOA Enablement Server for Java to screen
--verbose 0-5

0: Parses descriptor on the server.

1 (default): Parses descriptor on the client, shows line and column number in error message

2: Same as 1 and prints stack trace

--validate true/false If true, deployment descriptor contained in JAR will be validated against WSO2 SOA Enablement Server for Java XML schema. Default value is true. Only descriptors with targetNamespace=http://systinet.com/wasp/package/1.3 are validated. Location of XML schema is read from WSO2 SOA Enablement Server configuration.

--help

-h

Prints list of these options to screen

Undeploy  Locate

The Undeploy tool, like Deploy, is included in the Core-Tools component (see Core-Tools in the Components chapter). It is started from the %WASP_HOME/bin directory. Running Undeploy from the command line without any parameters shows the help screen.

To undeploy a package from the server, follow the steps in Undeploying Package from Server.

Procedure 6. Undeploying Package from Server

  1. Type Undeploy

  2. If the target server's URL is not http://localhost:6060, specify the URL with the --target URL option.

  3. If the package was installed to a context (see Contexts), specify this with the --context CONTEXT option.

  4. You may undeploy a package regardless of any dependencies upon it by using the --force option.

    When the Undeploy command is issued, the package is checked to see if it has any dependent packages before the Undeploy process is completed. If dependent packagess exist and you have not used the --force option, the server will issue an exception and will not undeploy the package. With the --force option, the server will undeploy the desired package regardless of dependencies.

    [Caution]Caution

    Be careful when you undeploy with --force. Removing a package will cause errors if any other package still depends on it.

  5. Type either --package and the QName of the package to undeploy or the filename of the JAR file that contains the package's files.

    If you give the QName of the package, the server finds a package with this name and undeploys it. If you give the filename of a JAR file, the server compares the QNames of the packages in this file with the installed packages on the server.

  6. Enter the command line.

If the --package option is used to supply the package name, keep in mind that it is a fully qualified name, requiring the target namespace as a prefix. The target namespace used as a default prefix is http://my.org.

The command in Example 208 undeploys the Hello package on http://myserver:8080. Note that the package name argument (--package) has the prefix http://hello.org to qualify the name of the package.

Example 208. Undeploying the HelloService Package

Undeploy --target http://myserver:8080 --package http://hello.org:Hello

By contrast, the command in Example 209 undeploys a JAR file on the default URL, http://localhost:6060, where the service path includes the helloContext context.

Example 209. Undeploying hello.jar with helloContext on the Path

Undeploy --context helloContext hello.jar

If another package on the server depends on the package you would like to undeploy , an exception is thrown and the command is ignored. You can force undeployment of the package by using the --force switch. This is shown with undeployment of the HelloService in Example 210.

Example 210. Undeploying a Package Regardless of Dependencies

Undeploy --force --package http://my.org:Hello

You can retrieve a complete list of deployed packages from the server with either Deploy or Undeploy, as described in Package Listing. Additional options for Undeploy are identical as for Deploy, as described in Other Switches.

Security Settings  Locate

If you are going to deploy or undeploy remotely with a secure WSO2 SOA Enablement Server Server, you must be authenticated. Deploy/Undeploy also has a set of parameters that enable you to acquire authentication along with any of the commands you may be using:

Deployment Options for Secure Server

--username

The user identity on the secure server

--password

User's password

--secprovider

Security provider to be used for the authentication

The command in Example 211 deploys the Hello package in the Deploy chapter if the server is secure:

Example 211. Deploying to a Secure Server

Deploy --username admin --password changeit ../demo/basic/hello/server/classes/hello.jar

Note that the security parameters always follow the parameters of the command. If you do not specify them, you will be prompted when contacting a secured WSO2 SOA Enablement Server.

Sometimes additional security settings have to be activated on a deployed service before the first call. In this case, use the --disabled parameter with Deploy to disable all services immediately after the Deploy process. This prevents any calls being made to the service before the additional security settings have been activated. The following command deploys the Hello package using the --disabled parameter:

Example 212. Deploying a Disabled Service

Deploy --disabled ../demo/basic/hello/server/classes/hello.jar