Good day,

I’m writing a servlet handling XML RPC using the ws-apache XML RPC server
and client. I’ve managed to get the server working in Apache Tomcat
5.5.27, at least the servlet gets initialized and Tomcat seems to respond
to incoming calls.

To clarify myself:
I’ve extended the XmlRpcServlet with my own Servlet class:

public class RemazServlet extends XmlRpcServlet {

        public void init(ServletConfig arg0) throws ServletException {
                super.init(arg0);
                System.out.println("----RemazServlet initialized");
        }

        protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
                System.out.println("----doGet()”);
                super.doGet(req, resp);
        }

        public void doPost(HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException {
                System.out.println("----doPost()”);
                super.doPost(request, response);
        }
}

My web.xml is as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd";>

<web-app>
        <servlet>
        <servlet-name>remazrpc</servlet-name>
        <servlet-class>nl.remaz.xmlrpc.webserver.RemazServlet</servlet-class>
        <load-on-startup>1</load-on-startup>

        <init-param>
          <param-name>enabledForExtensions</param-name>
          <param-value>true</param-value>
                </init-param>
        <init-param>
          <param-name>enabledForExtensions</param-name>
          <param-value>false</param-value>
                </init-param>
        <init-param>
          <param-name>contentLengthOptional</param-name>
          <param-value>false</param-value>
                </init-param>
        </servlet>

    <servlet-mapping>
        <servlet-name>remazrpc</servlet-name>
        <url-pattern>/remazrpc</url-pattern>
    </servlet-mapping>

</web-app>

When I start Tomcat, I see the line "----RemazServlet initialized"
appearing, which means my servlet is initialized (right?)
When I use my XmlRpcClient to connect to http://localhost:8080/remazrpc I
see the line "----doGet()” appearing. In return, I got a 405:
org.apache.xmlrpc.client.XmlRpcHttpTransportException: HTTP server
returned unexpected status: Method Not Allowed

That was to be expected, considering that XML RPC is POST so I expect that
performing a GET request returns an error.

But that is exactly my problem: Why is my client sending a GET request
instead of a POST request? I’ve tried “redirecting” the request to
super.doPost(), but that gave the following error:
org.apache.xmlrpc.XmlRpcException: Failed to parse XML-RPC request:
Premature end of file.

I’ve tried looking up the Content-length of the request, but for both
doGet() and doPost() those are -1. They shouldn’t be -1 as far as I know?

Can anyone give me some pointers as to why my client is sending a GET
request? Or otherwise: why my server is interpreting a request as GET
instead of POST?

Kind regards,
Roald Hoolwerf


Reply via email to