Java RPC Client for Frontier

Java XML-RPC Client

This client will allow you to use the Frontier XML-RPC framework from within any Java application. Using these classes with Frontier can allow for the creation of distributed applications with Java being the GUI and Frontier being the back-end engine.

Download

The necessary files are found within the rpc.zip file. Put this file within your classpath and import com.barista.rpc.* You will be all set. Also included with this zip file is a TestClient.java file which can be compiled and ran as a test of the client. This file also shows how to call the client.

For example, here are two ways to call one of the example scripts from UserLand.

try
{
	Object[] numParam = new Object[1];
	Long stateNum = new Long(24);
	numParam[0] = stateNum;
	RPCClient rpc = new RPCClient();
	rpc.setServer("betty.userland.com");
	rpc.setPort(80);
	rpc.setProcedureName("examples.getStateName");
	rpc.setParams(numParam);
	String stateName = (String)rpc.executeRPC();
}
catch (RPCException ex)
{
	ex.printStackTrace();
}

or

try
{
	Object[] numParam = new Object[1];
	Long stateNum = new Long(24);
	numParam[0] = stateNum;
	RPCClient rpc = new RPCClient("betty.userland.com",80,"examples.getStateName",numParam);
	String stateName = (String)rpc.executeRPC();
}
catch (RPCException ex)
{
	ex.printStackTrace();
}

I have tried to mirror the Frontier rpc client as much as possible. Not all of the data structures are the same so when Frontier expects a list, Java will use a Vector and when Frontier expects a table, Java will use a Hashtable. The params of the RPC script will be an Object[] array. This will hold the various parameters of the RPC script which will be called on the Frontier server.

In order to create the Object[] array, all primitive data types must be cast into their parent objects. For example, if I have a long which I want to pass to Frontier, I must change its value to a Long. The TestClient.java file gives examples of this process. Generally all that needs to be done is to use the default constructor for the parent object.

I hope these classes will help in the creation of new apps which use the power of both Java and Frontier. I'm always open to any questions, so if you need to get in touch with me, drop me an email at josh@stonecottage.com. I'm also on the ScriptMeridian list if that is a more appropiate medium.

Please let me know if you used these classes and what you thought. My plan is to release the source after I have nailed down a few more things.

thanks,
josh


This page was last built on 7/1/98; 9:34:16 PM by Joshua Lucas. josh@stonecottage.com At the moment I am using Macintosh OS to work on this website.