Remote Sever Setup

It is now possible to set up a remote server with a script that does most of the work for you. You can find it at [RemoteServerSetupScript] . Alternately, you can use the traditional method below.

For a basic introduction to these concepts, please see the Java 1.4 J2EE tutorial, section 8 on JAX-RPC, much of this is a modification of steps taken in that tutorial. Make sure Sun Application Server 8.1 is already installed on the target machine.

Generate the WSDL and Mapping Files

You will need to download the source code, compile it and create WSDL and mapping files.

  • Check out the sharedrecords/ repository from SVN. You can do this on the command line:

svn checkout  https://www.sharedrecords.org/svn/sra/trunk

  • Navigate to etc/, and run the ant build file that will strip the module of SVN information, build the code base and compile the web service bindings and create mapping information. On the command line:

asant wscompile

Package the Webservice

The webservice must now be packaged into a .WAR (Web Archive) file. This can be done using ant if you can get a command line on the machine you are deploying on, or using deploytool locally or remotely.

  • Using Ant
    • If you have already compiled the WSDL bindings, ant will create the appropriate archive file. On the command line:

asant create-war

  • Using Deploytool
    • Getting Started
      • Run deploytool.
      • If you are packaging the application on the local machine, you need not do anything different. Otherwise, you will need to go to File -> Add Server, and enter your server's name and administrative port (likely 4848). Make this the target server, and continue.
    • Creating a new component.
      • To start the New Web Component wizard, select File -> New -> Web Component.
      • At the bottom of the introductory dialog box, read the explanatory text for an overview of the wizard's features, and click Next.
      • At the WAR File dialog box, select the button labeled Create New Stand-Alone WAR Module. In the WAR Location, click Browse, navigate to the sharedrecords/ directory, enter SRCStore.war in the filename field, and click Create Module File. Under War Name, enter SRCStore.
      • Select Edit Contents. In the tree under Available Files, locate the sharedrecords/build subdirectory, click Add. Locate the sharedrecords/lib subdirectory, select the dom4j and jaxen jars, click Add, and then click OK. Under Context Root, enter /SRCDataStore. Click Next.
      • At the Choose Component Type dialog box, select the Web Services Endpoint button, and click Next.
      • At the Choose Service dialog box, under WSDL File, select WEB-INF/wsdl/SRCDataStoreService.wsdl. Under Mapping File, select build/mapping.xml. Click Next.
      • At the Component General Properties dialog box, under Service Endpoint Implementation, select org.sharedrecords.core.storage.LocalDataStore?. Click Next.
      • At the Web Service Endpoint dialog box, under Service Endpoint Interface, select shrc.storage.IDataStore. Under Namespace, select urn:SRCDataStoreService. Under Local Part, select IdataStorePort?. The deploytool utility will enter a default Endpoint Address URI LocalDataStore? in this dialog. This endpoint address must be updated in the next section. Click Next, and then Finish.
    • Specifying the endpoint address. To access SRCDataStoreService, the clients will specify this service endpoint address URI:  http://localhost:8080/SRCDataStore/datastore. The /SRCDataStore string is the context root of the servlet that implements SRCDataStoreService. The /datastore string is the servlet alias. You already set the context root above To specify the endpoint address, set the alias as follows.
      • In deploytool, select SRCDataStore in the tree. In the tree, select LocalDataStore?. Select the Aliases tab. In the Component Aliases table, add /datastore. In the Endpoint tab, select datastore for the Endpoint Address in the Sun-specific Settings frame. Select File -> Save.

Deploy the Webservice

The webservice must now be deployed on the Sun Java System Application Server. This can be done using ant if you can get a command line on the machine you are deploying on, or using deploytool locally or remotely.

After this step, you can view the WSDL file of the deployed service by requesting the URL

 http://localhost:8080/SRCDataStore/datastore?WSDL

  • Using Ant
    • If you have already packaged the .war file, and can deploy the file for you. On the command line:

asant deploy

  • Using Deploytool
    • In deploytool tree, select SRCStore.
    • Select Tools --> Deploy.

Set Server Security Policy

  • Copy the file server.policy from sharedrecords/etc/ and replace the existing server.policy with it. On a standard installation of the Sun App Server, the server policy file is in [Sun App Server Home]/domains/domain1/config/

Creating Client-Side Classes

Now you are ready to create a client that accesses this service. Go to the root of your project, and run the following command (also stored as wsimport.bat):

wscompile –import –d build –nd build –f:norpcstructures –classpath build config-wsdl.xml

This will create class stubs in shrc.remoting. Go to the build/shrc/remoting directory and create a new jar file called SRCRemoting.jar containing the three class files in this directory.