This example shows how to interact with the Novell exteNd WSSDK Server using a Java RMI client. The client invokes the built-in deploy server running at the root page.
The remote interface for the Deploy service is shown below:
/* * $Id: Deploy.java,v 1.1.1.1 2003/06/13 01:42:40 vijay Exp $ * * Copyright 2001-2002 by Novell, Inc. * All rights reserved. * * This software is the confidential and proprietary information of * Novell, Inc. ("Confidential Information"). You shall * not disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with Novell. */ package com.sssw.jbroker.web.server; import java.rmi.Remote; import java.rmi.RemoteException; public interface Deploy extends Remote { /** Deploy a service. @param location Desired location. @param war Byte array with WAR file. */ void deploy(String location, byte[] war) throws RemoteException; /** Un-deploy a service. @param location Web Service location. */ void undeploy(String location) throws RemoteException; /** List all deployed services. @return Array of locations. */ String[] list() throws RemoteException; }
The deploy
method takes a byte array, which is assumed to be a WAR file
image. The server processes the WAR file and dynamically loads the Web services included
in the archive. Similarly, the undeploy
unloads a set of deployed Web
services. The list
methods returns a list of all Web services deployed
in the server.
A client for the Deploy service is listed below:
package deploy; import java.rmi.Remote; import java.rmi.RemoteException; import java.io.File; import java.io.FileInputStream; import javax.naming.InitialContext; public class Client { static final String _ds = "com.sssw.jbroker.web.server.DeployService"; public static void main(String[] args) throws Exception { | // get the deploy service | InitialContext ctx = new InitialContext(); | com.sssw.jbroker.web.server.DeployService svc = | (com.sssw.jbroker.web.server.DeployService) | ctx.lookup("xmlrpc:soap:" + _ds + "@" + | ((args.length > 0) ? args[0] : "http://localhost:9090")); | com.sssw.jbroker.web.server.Deploy deploy = | (com.sssw.jbroker.web.server.Deploy) svc.getDeployPort(); | | String[] list = deploy.list(); | for (int i = 0; i < list.length; i++) | System.out.println(list[i]); | | File file = new File(".." + File.separatorChar + "hello" + | File.separatorChar + "services.war"); | FileInputStream fis = new FileInputStream(file); | byte[] b = new byte[fis.available()]; | fis.read(b); | fis.close(); | | System.out.println("uploading " + b.length + " bytes from " + file); | | deploy.deploy("/hello", b); } }
To run the client against a Novell exteNd WSSDK Server running on the default port 9090, you can issue the following command:
java deploy.Client http://localhost:9090
The client assumes a file called services.war
in the current directory.
You can for instance copy the services.war
file from the Hello World example.
Please refer to the README for detailed instructions on compiling and running the example.
Copyright © 2003, 2004 Novell, Inc. All rights reserved. Copyright © 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.