Title: servlet

Thanks John

I've just started ot look at the applet and will likely proceed that way

 

My own thoughts went like this

I first tried to look at the inputstream by piping it straight back to the caller (instead of passing it to the xmlrpc client) just so I could see what was going on

But that didn't work very well and I suspect for the reasons you mention i.e. header stuff

 

Anyway I hope to get something working soon and thanks for the help

Lou

 

-----Original Message-----
From: John Twomey [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 03, 2002 6:03 AM
To: [EMAIL PROTECTED]
Subject: RE: servlet

 

Hi Louis,

 

Using a standard HTTP POST does not seem to work since the post method will URLencode(or something - its early) the XML-RPC call. The Post includes headers etc. and some charactors are encoded - XML RPC only wants the call as you have it in your post box. This can be confirmed by the fact that you recieved an answer from your "LiteClient" - so your servlet works!!!

The answer probably lies in using the XML-RPC applet to make the call and probably process the return.

 

Thats My take on it anyway - others may have more to add or take away.
If someone has an answer to making an HTTP POST work I would love to know it. 

 

 

Take care,

 

John 

-----Original Message-----
From: Daly, Louis
Sent: Tue 4/2/2002 5:22 PM
To: '[EMAIL PROTECTED]'
Cc:
Subject: servlet

 

I really need to get one basic thing going so I can start to figure out
stuff

This form calls my servlet
http://lou.library.arizona.edu/testmail.html
myservlet is below (tries to call Echo)

I know the server is running as I started it like so

C:\>java org.apache.xmlrpc.WebServer 9000
And this works
C:\tom4\webapps\examples\WEB-INF\classes\org\apache\xmlrpc>
c:\java14\bin\java org.apache.xmlrpc.XmlRpcClientLite
http://lou.library.arizona.edu:9000 echo test 123
        [test, 123]

help!
lou


//??????????????????????????????????????????????????????????????????
// Copyright 1999 Hannes Walln�fer, Raphael Spannocchi

package org.apache.xmlrpc;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.Vector;

public class XmlRpcServlet extends HttpServlet implements XmlRpcHandler {

    public XmlRpcServer xmlrpc;

        xmlrpc = new XmlRpcServer ();

    public void init (ServletConfig config) throws ServletException
    {
        if ("true".equalsIgnoreCase (config.getInitParameter ("debug")))
            XmlRpc.setDebug (true);
        String url = config.getInitParameter ("url");
        xmlrpc = new XmlRpcServer ();
        try
        {
            xmlrpc.addHandler ("$default", new XmlRpcClientLite (url));
        }
        catch (Exception x)
        {
            throw new ServletException ("Invalid URL: "+url + " ("+
                    x.toString () + ")");
        }
    }


        try
        {
            xmlrpc.addHandler ("$default", new XmlRpcClientLite ());
        }
        catch (Exception x)
        {
            throw new ServletException ("Invalid URL: "+url + " ("+
                    x.toString () + ")");
        }
    }



    public void doPost(HttpServletRequest req, HttpServletResponse res)
                throws ServletException, IOException  {
        byte[] result = xmlrpc.execute (req.getInputStream ());
        res.setContentType("text/xml");
        res.setContentLength (result.length);
        OutputStream output = res.getOutputStream();
        output.write (result);
        output.flush ();
    }

    /**
     * Callback method for XML-RPC server
     */
    public Object execute (String methodname, Vector params) {
        return params;
    }

}

Reply via email to