tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Baranski" <list-subscripti...@secmgmt.com>
Subject 302 Error with XMLRPC app
Date Thu, 29 Oct 2009 15:33:59 GMT


Here is my web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun
Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>

    <display-name>Security Managment Consulting</display-name>

   <servlet>
        <servlet-name>XmlRpcServlet</servlet-name>
 
<servlet-class>org.apache.xmlrpc.webserver.XmlRpcServlet</servlet-class>
    </servlet>

    <servlet-mapping>
        <servlet-name>XmlRpcServlet</servlet-name>
        <url-pattern>/xmlrpc-status/*</url-pattern>
    </servlet-mapping>

</web-app>

I have the following java class:

package com.secmgmt.xmlrpc.change_status; import org.apache.log4j.Logger;

public class ChangeStatus
{
    public static final int SUCCESS = 0;
    public static final int INVALID_LOGIN = 1;
    public static final int EID_NOT_FOUND = 2;
    public static final int SERVER_NOT_PRIMARY = 3;
    public static final int NO_CHANGE_NEEDED = 4;

    private static Logger l = Logger.getLogger(ChangeStatus.class);

    public static final String ACTIVE = "ACTIVE";
    public static final String INACTIVE = "INACTIVE";
    
    public static final int PP_ACTIVE = 0;
    public static final int PP_INACTIVE = 1;
    
    public ChangeStatus()
        {
            l.debug("Created the status xmlrpc class");
        }

    public boolean ping()
        {
            return true;
        }

    public int add(int one, int two)
        {
            l.debug("Adding " + one + " and " + two);
            return one + two;
        }

    public int changeStatus(String eid, String user, String password, String
status)
        {
            return SUCCESS;
        }
}

The following in the properties file:
ChangeStatus=com.secmgmt.xmlrpc.picture.four.change_status.ChangeStatus

My webapp deploys properly, and I never see an error in the logs anywhere
when I hit it.  My python program is:

#!/usr/bin/python2
import xmlrpclib
from pprint import pprint

p = xmlrpclib.ServerProxy("http://192.168.1.15:8080/xmlrpc-status")
print "Server created"
try:
    #print p.system.listMethods()
    #print dir(p)
    p._ServerProxy__verbose = 1
    print "Ping result: %s" % (p.ChangeStatus.ping()) except
xmlrpclib.Error, v:
    print "ERROR", v
    pass

print "Done"

Here is the output:

Server created
connect: (192.168.1.15, 8080)
send: 'POST /xmlrpc-status HTTP/1.0\r\nHost:
192.168.1.15:8080\r\nUser-Agent: xmlrpclib.py/1.0.1 (by
www.pythonware.com)\r\nContent-Type: text/xml\r\nContent-Length:
111\r\n\r\n'
send: "<?xml
version='1.0'?>\n<methodCall>\n<methodName>ChangeStatus.ping</methodName>\n<
params>\n</params>\n</methodCall>\n"
reply: 'HTTP/1.1 302 Moved Temporarily\r\n'
header: Server: Apache-Coyote/1.1
header: Location: http://192.168.1.15:8080/xmlrpc-status/
header: Date: Wed, 28 Oct 2009 19:47:50 GMT
header: Connection: close
ERROR <ProtocolError for 192.168.1.15:8080/xmlrpc-status: 302 Moved
Temporarily> Done

Any idea why I get the 302 error?  My XML-RPC appears to be correct.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message