Maintaining the LinBox Webservice

On this page I document exactly how the LinBox web service was developed and how it may be updated and maintained. If you have any further questions, feel free to email me at matt.fendt@gmail.com. Please prefix the subject line of your email with [LINBOX].
-- Matthew Fendt, January 2008

Page Contents

Building the Server
Building the Clients
The linalg Client
Updating and Maintaining the Service
New to Summer '08
New to Winter '09


Building the Server


A "server" is the computer on which the web service will be hosted. It is also where the LinBox library is installed and where the computations are done. The following contains the step that were taken to install the server on hmrg.

Some things to note: Requirements: Setup:
  1. Install Ant, Tomcat, Axis2, and Java
  2. Set CATALINA_HOME to Tomcat directory (eg /home/fendt/apache-tomcat-6.0.18)
  3. Set AXIS2_HOME to Axis 2 directory (eg /home/fendt/axis2-1.4.1)
  4. Set ANT_HOME to Ant directory (eg /home/fendt/apache-ant-1.7.0)
  5. Set JAVA_HOME to Java directory (eg /usr/lib/jvm/java-6-sun)
  6. Make sure Apache is shut down.
  7. Svn and configure the LinBox library. This was done on hmrg.pc.cis. udel.edu in the directory /home/fendt/linbox. This is the copy of LinBox that the web service will use.
  8. Copy the LinBoxWebservice directory, located at /home/fendt/LinBoxWebservice.
  9. In LinBoxWebservice directory, type "ant generate.service" to ready the service.
  10. Start up Apache with ./home/fendt/apache-tomcat-6.0.18/bin/startup.sh
  11. The web service is now installed in the "services" directory on Apache, is listening on port 2000, and ready for client calls.
Return to top


Building the Clients


A "client" is any computer that gives information to a "server" computer in order to find the result of a computation. The following can be done to install a client activity on any computer, be it an online web form or a stand alone program.

Requirements: Setup:
  1. Install Ant, Axis2, and Java
  2. Set AXIS2_HOME to Axis 2 directory (eg /home/fendt/axis2-1.4.1)
  3. Set ANT_HOME to Ant directory (eg /home/fendt/apache-ant-1.7.0)
  4. Set JAVA_HOME to Java directory (eg /usr/lib/jvm/java-6-sun)
  5. Copy the LinBoxWebservice directory, located at /home/fendt/LinBoxWebservice.
There are currently four different kinds of clients that can be installed:
  1. A stand-alone client that is run from the command line (TransferAgentStandalontClient).
  2. A dependent client that relies on another class to receive the answer (TransferAgentDependentClient). An example of this second client is the linalg client.
  3. A prototype client that does not call LinBox directly, but rather waits in a queue to be processed (TransferAgentUserClient). This is still being developed.
  4. A prototype client that listends for enqueue messages and makes the calls to LinBox. This is still being developed.


To Install and Run the Stand Alone Client:
  1. In the LinBoxWebservice directory, type "ant generate.standalone.client"
  2. The client can now be run in the LinBoxWebservice directory, for example: "ant run.standalone.client -Darg1=rank -Darg2=matrices/mat2.txt"
To Install and Run the Dependent Client:
  1. In the LinBoxWebservice directory, type "ant generate.dependent.client"
  2. The class is compiled to LinBoxWebservice/build/client/build/classes/samples/ quickstart/clients/TransferAgentDependentClient.class and can be imported by other classes.
To Install and Run the Experimental User Client:
  1. In the LinBoxWebservice directory, type "ant generate.user.client"
  2. The client can now be run in the LinBoxWebservice directory, for example: "ant run.user.client -Darg1=rank -Darg2=matrices/mat2.txt"
To Install and Run the Experimental Queue Client:
  1. In the LinBoxWebservice directory, type "ant generate.queue.client"
  2. The client can now be run in the LinBoxWebservice directory, for example: "ant run.queue.client"
Return to top


The linalg Client


The linalg client is a particular instance of the dependent client build described above. The client is hosted on linalg and processes data from a web form on linalg.org. The client then sends the data to hmrg to compute the answer.

Getting the software
  1. Get LinBoxWebservice directory from fendt@hmrg to desired location, eg /usa/fendt/LinBoxWebservice
  2. Unzip axi2-1.2.zip, to eg /usa/fendt/axis2-1.2
  3. Unzip commons-fileupload-1.2-bin.zip, to eg /home/www/usa/linbox
  4. Unzip commons-io-1.3.2-bin.zip, to eg /home/www/usa/linbox
  5. The zip files for 3) and 4) are found on the apache web site, www.apache.org.
  6. Install tomcat in /home/www/usa/linbox/apache-tomcat-6.0.13
Modifying the software
  1. Set JAVA_HOME variable to /usr/jdk/jdk1.5.0_07 NOTE: The service will not work if this variable is set to an older version of Java. If the service is not working, check to see if there is a newer version of Java.
  2. Set AXIS2_HOME to /usa/fendt/axis2-1.2
  3. Change port to 8080, in tomcat's conf/server.xml at line 50
Setting up the web client
  1. Make the following directories in /home/www/usa/linbox/apache-tomcat-6.0.13/webapps/ROOT/WEB-INF/
  2. - lib
    - classes/samples/quickstart/service/adb
    - classes/samples/quickstart/clients
  3. Run "ant.generate.dependent.client" in LinBoxWebservice directory
  4. Copy build/client/build/classes/samples/quickstart/clients/TransferAgentDependentClient.class to /home/www/usa/linbox/apache-tomcat-6.0.13/webapps/ROOT/WEB-INF/classes/samples/quickstart/clients
  5. Copy all files from build/client/build/classes/samples/quickstart/service/adb/ to /home/www/usa/linbox/apache-tomcat-6.0.13/webapps/ROOT/WEB-INF/classes/samples/quickstart/service/adb
  6. Copy build/client/build/lib/Services-test-client.jar to /home/www/usa/linbox/apache-tomcat-6.0.13/webapps/ROOT/WEB-INF/lib
  7. Copy commons-io-1.3.2.jar to /home/www/usa/linbox/apache-tomcat-6.0.13/webapps/ROOT/WEB-INF/lib
  8. Copy commons-fileupload-1.2.jar to /home/www/usa/linbox/apache-tomcat-6.0.13/webapps/ROOT/WEB-INF/lib
  9. Copy "LinalgComputingClient.jsp" and "SubmitComputation.jsp" to /home/www/usa/linbox/apache-tomcat-6.0.13/webapps/ROOT/
Running the web client
  1. Make sure the web service on hmrg is running!!!
  2. Start up tomcat.
  3. The web client is ready to go. Note that when tomcat is first started up that the web page may need to be "reloaded" several times before the service starts running.
  4. If you manage to kill my service on linalg, you may need to restart the web service on hmrg before the linalg web client can work again. :)
Return to top


Updating and Maintaining the Service


Compilation of LinBox Functional .so From Default Directory on Hmrg
  1. cd to /home/fendt/LinBoxWebservice/src/samples/quickstart/service/adb/xsd
  2. In makefile: Make sure that the path of the LinBox library is correct. It is currently -I/home/fendt/linbox
  3. Type "make liblinboxfunctions.so"
  4. The .so should be ready to be used.
Relocating the LinBox Function .so
  1. In makefile, set the path to the LinBox library, eg "-I/home/fendt/linbox"
  2. Follow compilation instructions as above
To Add Additional LinBox Functionality
  1. In linboxfunctions.i: Add both the computation function, eg and the i/o function, eg both inside and outside the %{ ... %} block
  2. In linboxfunctions.C: Update the "Currently supported methods" section, #include the appropriate files from the linbox library, and add the appropriate "file" variable. Add new computation and i/o function.
  3. Run the .i file through SWIG (swig -java -c++ -package samples.quickstart.service.adb.xsd linboxfunctions.i). This will generate the necessary interfacing for the C++ linbox code to work with the Java web service.
  4. Type "make liblinboxfunctions.so"
  5. The .so should be ready to be used. Note that if only "linboxfunctions.C" needs to be changed, step 3 can be ommited.
  6. The resources/META-INF/services.xml file needs to be updated; add a new "operation" tag to the file.
  7. The service should be reinstalled on hmrg so that the new service is added.
  8. The client code also needs to be updated to accomidate the new functionality.
Return to top


New to Summer '08



Previously, the web service calls could only be done synchronously and one at a time. I have changed this so that they are asynchronous and the service can handle more than one request at a time. I did this by seperating the model into three parts: The client, the middleman/queue, and the service.

The client is now called the TransferAgentUserClient. It does not call the LinBox service directly, but rather calls the middleman (which itself is a web service). It is asynchronous and currently has the following functions:

The middleman is a new intermediate web service. It is what the user will now call instead of the original web service. When it recieves a request, it enqueues the request in a queue. It then waits for the queue manager to give it back the answer. When it does, the middleman returns the answer to the user.

The Queue client (also called the Queue manager) is first run before any LinBox calls are made. It creates a persistant queue which holds the middleman's web service calls. The Queue client then dequeues from the queue and calls the original LinBox web service. When it gets the answer back from the LinBox web service, it stores the information for the middleman to retrieve. Note that the middleman web service and the Queue client must be on the same machine, because they communication via Java RMI. However, these two do not have to be on the same machine as the LinBox web service, since the Queue client and the LinBox web service communicate via web service calls.

The LinBox web service is virtually unchanged. It is simply called by the Queue client instead of the original StandAlone or Dependent clients.

[OUTDATED, USE THE INSTRUCTION FROM THE WINTER, BELOW] Copy the LinBoxWebservice directory as before. Then in that directory:
  1. Generate the LinBox web service with ant generate.service
  2. Generate the middleman web service with ant generate.middleman
  3. Start up apache with /home/fendt/apache-tomcat-6.0.18/bin/startup.sh
  4. Generate the user client with ant generate.user.client
  5. Generate the queue client with ant generate.queue.client
  6. Start up RMI with /usr/lib/jvm/java-6-sun/bin/rmiregistry
  7. Start the queue client with ant run.queue.client
  8. Start the queue client with ant run.user.client
  9. You can now make web service calls with the user client (see list of functions above).


Return to top

New to Winter '09

The command line client can now be run as follows:

To Run the Service With the New Model

Copy the LinBoxWebservice directory to hmrg and linalg. Then
  1. Shut down apache on hmrg with /home/fendt/apache-tomcat-6.0.18/bin/shutdown.sh
  2. Generate the LinBox web service on hmrg with ant generate.service
  3. Start up apache on hmrg with /home/fendt/apache-tomcat-6.0.18/bin/startup.sh
  4. Generate the middleman web service on linalg with ant generate.middleman
  5. Generate the queue client on linalg with ant generate.queue.client
  6. Generate the user client on hmrg with ant generate.user.client
  7. Start up RMI on linalg with //usr/jdk/jdk1.5.0_15/bin/rmiregistry
  8. Start the queue client on linalg with ant run.queue.client
  9. Start the queue client on hmrg with ant run.user.client
  10. You can now make web service calls on hmrg with the user client (see list of functions above).
Return to top

Return to server page