Hi, I'm replying to my own email since I've found a solution and there's nothing worse than searching for a problem, finding the question but there is no answer ...
I still have no idea why I get a 302 Moved Temporarily error but if I use Jetty on port 8888 instead of tomcat the following script works. $ ./$XINDICE_HOME/xindice.sh start Starting Xindice - Log files are under $XINDICE_HOME/logs Xindice is running with PID XXXX $ python2.3 >>> import xmlrpclib >>> server = xmlrpclib.Server("http://localhost:8888/xindice") >>> result = server.run({"message":"ListCollections", "collection":"/db"}) >>> print result {'result': ['trial', 'system', 'meta', 'test']} The syntax of the message passing is a bit different to the examples I could find. Hope this helps someone! :) Suzanne This is my test script ------------------------------------ #!/usr/bin/python import xmlrpclib def main(): print "---start tests---" server = xmlrpclib.Server("http://localhost:8888/xindice") print "---list collections---" result = server.run({"message":"ListCollections", "collection":"/db"}) print result print "---add document---" document = open("book.xml", "r") args = {"message":"InsertDocument", "collection":"/db/trial", "document":document.read(), "name":""} result = server.run(args) print result document.close() print "---query---" args = {"message":"Query", "collection":"/db/trial", "type":"XPath", "query":"//author"} result = server.run(args) print result print "---end tests---" if __name__ == '__main__': main() ------------------------------------ This is the output: $ ./pyTestXindice.py ---start tests--- ---list collections--- {'result': ['trial', 'system', 'meta', 'test']} ---add document--- {'result': '5c4e9a7e63746b7400000100de333eb7'} ---query--- {'result': '<?xml version="1.0"?>\n<result count="4"><author xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/trial" src:key="test123">JRR Tolkien</author><author xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/trial" src:key="test123">JK Rowling</author><author xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/trial" src:key="test124">Charles Dickens</author><author xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/trial" src:key="test124">Jane Austen</author></result>'} ---end tests--- On Mon, 13 Dec 2004, Suzanne Little wrote: > Hi, > > I'm trying to use the xmlrpc interface to interact with xindice but the > only response I get is > "xmlrpclib.ProtocolError: <ProtocolError for localhost:8080/xindice: 302 > Moved Temporarily>" when using python > or > "XML-RPC Fault #5: Didn't receive 200 OK from remote server. (HTTP/1.1 302 > Moved Temporarily)" when using php. > > Configuration details are: > Redhat linux kernel 2.4.18-27.8.0 > java jdk1.3.1_07 > tomcat 5.0.19 > xindice - tried both the 1.1b4 release and cvs source 1.1b5-dev > > For xmlrpc access I tried both python 2.2.1 with the standard xmlrpclib > (which I want to use) and php 4.3.4 with phpxmlrpc library (just in case > it was python specific). > > Example session: > >>> import xmlrpclib > >>> server = xmlrpclib.Server("http://localhost:8080/xindice") > >>> server.execute("db.GetDocumentCount", ('/db/testing')) > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File "/usr/lib/python2.2/xmlrpclib.py", line 821, in __call__ > return self.__send(self.__name, args) > File "/usr/lib/python2.2/xmlrpclib.py", line 975, in __request > verbose=self.__verbose > File "/usr/lib/python2.2/xmlrpclib.py", line 848, in request > headers > xmlrpclib.ProtocolError: <ProtocolError for localhost:8080/xindice: 302 Moved > Temporarily> > > I can access the xindice installation via the browser > (http://localhost:8080/xindice) and via the commandline tools (xindice ac > -c xmldb:xindice://localhost:8080/db -n testing). > > Any suggestions? > > Thanks, > Suzanne >