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.