ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pedro Braga <>
Subject Using the Built-in HTTP Server
Date Thu, 23 Jun 2005 17:30:52 GMT

    Hello All,

I'm trying to use a built-in HTTP Server to "export" some methods.

I just start with an example I found on the Net.
It was from the time of "helma.xmlrpc.*" as you can see on the code. I 
changed to org.apache.xmlrpc.*

When I run the program it just starts and ends immediately without error!?!?

Can you help me, please?

Thanks in advance.

----------------------- <example> -----------------------
import java.util.Hashtable;
//import helma.xmlrpc.*;
import org.apache.xmlrpc.*;

public class JavaServer {

    public JavaServer () {
        // Our handler is a regular Java object. It can have a
        // constructor and member variables in the ordinary fashion.
        // Public methods will be exposed to XML-RPC clients.

    public Hashtable sumAndDifference (int x, int y) {
        Hashtable result = new Hashtable();
        result.put("sum", new Integer(x + y));
        result.put("difference", new Integer(x - y));
        return result;

    public static void main (String [] args) {
        try {
            // Invoke me as <http://localhost:8080/RPC2>.
            WebServer server = new WebServer(8080);
            server.addHandler("sample", new JavaServer());

        } catch (Exception exception) {
            System.err.println("JavaServer: " + exception.toString());

----------------------- </example> -----------------------

Pedro Braga

View raw message