Deploying web services applications onto application servers

After assembling the artifacts required to enable the web module for web services into an enterprise archive (EAR) file, you can deploy the EAR file into the application server.

Before you begin

To deploy Java-based web services, you need an enterprise application, also known as an EAR file that is configured and enabled for web services.

A Java™ API for XML-Based Web Services (JAX-WS) application does not require additional bindings and deployment descriptors for deployment whereas a Java API for XML-based RPC (JAX-RPC) web services application requires you to add additional bindings and deployment descriptors for application deployment. JAX-WS is much more dynamic, and does not require any of the static data generated by the deployment step required for deploying JAX-RPC applications.

For JAX-WS web services, the use of the webservices.xml deployment descriptor is optional because you can use annotations to specify all of the information that is contained within the deployment descriptor file. You can use the deployment descriptor file to augment or override existing JAX-WS annotations. Any information that you define in the webservices.xml deployment descriptor overrides any corresponding information that is specified by annotations.

Note: In a mixed node cell, you can only target a JAX-WS enabled enterprise beans module to a server using WebSphere® Application Server Version 7.0 and later. However, you can target a JAX-WS enabled web application archives (WAR) module to a server using either WebSphere Application Server Version 7.0 and later or WebSphere Application Server Version 6.1 Feature Pack for Web Services

You can use the wsdeploy command with JAX-RPC applications to add WebSphere product-specific deployment classes to a web services-compatible enterprise application enterprise archive (EAR) file or an application client Java archive (JAR) file.

To install or deploy a JAX-WS application, you only need to install the JAX-WS enabled EAR file. If your web services application contains only JAX-WS endpoints, you do not need to run the wsdeploy command, as this command is used to process only JAX-RPC endpoints.

Ensure that you have installed the HTTP or Java Message Service (JMS) router module that was generated with the endptEnabler command onto the same target as your web services enterprise bean JAR files. These HTTP or JMS router modules are included in your web services application and they need to use the runtime libraries of the application server.

About this task

This task is one of the steps in developing and implementing web services.

You can use either the administrative console or the wsadmin scripting tool to deploy an EAR file. If you are installing an application containing web services by using the wsadmin command, specify the -deployws option for JAX-RPC applications. If you are installing an application containing web services by using the administrative console, select Deploy WebServices in the Install New Application wizard. For more information about installing applications using the administrative console, see the installing enterprise application files with the console information.

If your JAX-RPC web services application was previously deployed with the wsdeploy command, it is not necessary to specify web services deployment during installation.

The following actions deploy the EAR file with the wsadmin command:

Procedure

  1. Start install_root/bin/wsadmin from a command prompt.

    [Linux][AIX][HP-UX][Solaris]On operating systems such as AIX or Linux, start install_root/bin/wsadmin.sh.

  2. Deploy the EAR file.
    • For JAX-WS web service applications, enter the $AdminApp install EARfile "-usedefaultbindings" command at the wsadmin prompt.
    • For JAX-RPC web service applications, enter the $AdminApp install EARfile "-usedefaultbindings -deployws" command at the wsadmin prompt.

Results

You have a web service installed onto your application server.

Avoid trouble: While installing web services applications that contain a large number of enterprise beans onto the application server, you might receive out of memory errors. If you receive out of memory errors, increase the heap size of your Java Virtual Machine (JVM). If you are installing the application server in a network deployment environment, you might need to increase the heap size of the JVM in the application servers in which you are installing the application, and in the deployment manager profile, dmgr. Read about tuning the IBM virtual machine for Java documentation to learn more about tuning the application server environment.

What to do next

You can confirm that the web services application was deployed by entering the web service endpoint URL in a browser, then viewing an informative page. The information page contains the following information:
{http://webservice.pli.tc.wssvt.ibm.com}RetireWebServices 
Hello! This is an Axis2 web service!
The first line of this information is variable, depending on your web service. The URI in the brackets is the namespace and the string that follows, in this example RetireWebServices, is the name of the port used to access the web service.

The next step you might want to consider is to apply security to your web service.