apache > ws.apache
WSRF
 

Deploy the service to the Apache WSRF Web Application

Introduction

The quickest way to deploy your WSRF service is to use the generated build script. The script compiles and deploys your WSRF service to the Apache WSRF Web application, which is an extension of the Apache-Axis Web application. This section describes how to use the generated build script and also how the script works, so you can build your own script.

Using the generated build scripts

The Wsdl2Java tool generates an Ant build script that is used to compile and deploy your WS-Resource. The script is located in the output directory under the subdirectory for your WS-Resource (e.g., generated/service_name).

To compile and deploy using the Ant script

  1. In your output directory, edit build.properties and modify the wsrf.webapp.dir. If you are using Tomcat and have CATALINA_HOME set, you do not need to modify this property.
  2. From a command prompt, change directories to generated/service_name
  3. Run:
	ant compile deploy 

Start Tomcat and verify that the service is deployed by going to http://localhost:8080/wsrf/services

Manually Deploying your Service

In this section we will describe how to manually deploy your service. We will describe each step in the process.

  1. Copy your WSDL file.

    Your WSDL file needs to be copied to an appropriate location in the webapp. We recommend you put it in the wsrf/WEB-INF/classes/wsdl directory. This allows Axis to reference it from the classpath and avoids the need to hard-code a location on your file system. This location is used when registering the service in the server-config.wsdd file.

  2. Copy your classes.

    You will need to copy any .class files, generated by Wsdl2Java or hand written, to the wsrf/WEB-INF/classes/ directory so that your service classes can be found by Apache WSRF.

  3. Update the wsrf-config.xml file.

    The wsrf-config.xml contains configuration information for each deployed WSRF service as well as global configuration for the WSRF runtime. This information is necessary for Apache WSRF to create your home and handle requests for your service. The resource homes for each WSRF service will be bound in JNDI at wsrf/resource/service_name. Here is the configuration entry for the FileSystem example WSRF service:

      <bean name="resource/filesystem" class="org.apache.ws.resource.example.filesystem.FilesystemHome" init-method="init">
        <property name="portComponentName"><value>filesystem</value></property>
        <property name="serviceClass"><value>org.apache.ws.resource.example.filesystem.FilesystemService</value></property>
        <property name="resourceClass"><value>org.apache.ws.resource.example.filesystem.FilesystemResource</value></property>
        <property name="resourceIdentifierReferenceParameterName"><value>{http://ws.apache.org/resource/example/filesystem}ResourceIdentifier</value></property>
      </bean>
    

    The id attribute of the bean element is an identifier that uniquely identifies the bean definition in the config file. It must be a valid XML ID and unique among the other bean defintions in the configuration file, but otherwise, its value is arbitrary. The class attribute specifies the full classname of the resource home class for this WSRF service. The "portComponentName" property indicates the unique deployment name for the WSRF service (i.e. the service name from Axis' server-config.wsdd or the last portion of the service's endpoint URL). The serviceClass property points to the full classname for the service class. The resourceClassName property points to the full classname for the resource class.

    The resourceIdentifierReferenceParameterName property represents the name of the WS-Addressing reference parameter SOAP header that is used to extract a unique resource identifier to lookup a specific WS-Resource instance. This value should be a QName that includes the local reference parameter name in the format {namespaceURI}localPart, where namespaceURI and localPart are the namespace and URI and local part of the qualified name of the reference paramater that should contain the resource identifier. If you omit this entry, it is assumed that the service exposes a SINGLETON WS-Resource and hence no resource id WS-Addressing reference parameter is expected in the SOAP header.

  4. Update the server-config.wsdd file

    The server-config.wsdd file is the configuration file for the Axis SOAP engine, which is bundled with Apache WSRF. This file is located in the wsrf/WEB-INF/ directory. See the Axis documentation for complete instructions about server-config.wsdd

    The file contains a deployment entry for each Web service. For example, the entry for the FileSystem example service is:

      <service name="filesystem" provider="java:WSRF" style="document" use="literal">
        <wsdlFile>/wsdl/FileSystem.wsdl</wsdlFile>      
      </service>

    The service name attribute is the endpoint name and should be the same as the port's name attribute from your WSDL file. This will ensure people consuming your WSDL will be able to invoke your service.

    Notice the entry for wsdlFile which points to the /wsdl/FileSystem.wsdl. This translates to the wsdl directory under the WEB-INF/classes directory.