A simple HTTP proxy to forward RPC invocations.
Before to start the Dispatcher, you have to configure it.
By default the Dispatcher starts on 80 port. To change the port number, edit the Dispatcher's properties file: xsul.dispatcher.rpc.default.properties
To compile the Dispatcher go to the directory: xsul/java and run this command:
$ ant dispatcher
To launch the Dispatcher:
$ cd XSUL_HOME/java
$ java -cp `./classpath.sh` xsul.dispatcher.rpc.DispatcherRPC
It is a very simple sample with one Web Service and multi clients which send requests to the Dispatcher and the Dispatcher forwards requests to the Web Service.
First, you have to configure the Routing Table of the Dispatcher to map virtual path with real Web Services addresses.
A virtual path is the path in requests from clients. The Dispatcher maps this path with its routing table to find the real address of the mapped Web Service.
Edit the file: xsul.dispatcher.routingtable.table.properties
To add a new element: virtual-path=host:port/path. Where virtual-path is the path in clients HTTP requests. The host:port/path is the address of the Web Service which the Dispatcher forwards the requests.
For this sample the Web Service is running in the same host of the Dispatcher. Just add this line in the routing table:
test=localhost:60002/
To run the Web Service on a different host just modify the address with the good one.
Start the EchoServer:
$ cd XSUL_HOME/java
$ java -cp ` ./classpath.sh` xsul_sample_hello.EchoServer 60002
To launch the Dispatcher:
$ cd XSUL_HOME/java
$ java -cp `./classpath.sh` xsul.dispatcher.rpc.DispatcherRPC
For more information see the Dispatcher section.
You can start n clients to send requests to the Dispatcher.
Start clients:
$ cd XSUL_HOME/java
$ java -cp `./classpath.sh` xsul_sample_hello.EchoMultiClients n dispatcher_address
Where n is the number of clients to launch, example:10 or 25.
Where dispatcher_address is the address of the Dispatcher, example: http://localhost/foo or http://foo.extreme.indiana.edu:2410/foo
For our local sample:
$ java -cp `./classpath.sh` xsul_sample_hello.EchoMultiClients 10 http://localhost/test