|
From: Bryan L. <b.n...@rl...> - 2006-07-04 15:01:38
|
I've just solved this ...
Although a much later copy of exist (1.0-dev-20060316) fails with the same
error message ... it turns out that simply wrapping the xquery using the
xmlrpclib.Binary() formalism fixes it. (Yes, I know I'd done it right for one
method, but I forgot to do it for this one ...)
Cheers
Bryan
On Monday 03 July 2006 21:37, Bryan Lawrence wrote:
> Hi Folks
>
> I'm using 1.0-dev-20050805 (we can't quite upgrade yet because of worries
> about changes to the soap interface, although this isn't about a problem
> with that ...).
>
> Anyway, I've built a piece of code around the example on the wiki (cut back
> etc). I have:
>
> class eXist_Connector(object):
> """Access class for eXist"""
> def __init__(self,constants=None):
> ''' Instantiates the eXist connector using supplied constants '''
> if constants is None: raise 'NoExistConstants'
> authinfo = urllib2.HTTPPasswordMgrWithDefaultRealm()
> authinfo.add_password(None,
> constants.host,
> constants.userid,
> constants.password)
> authHandler = urllib2.HTTPBasicAuthHandler(authinfo)
> opener = urllib2.build_opener(authHandler)
> s = constants.userid+':'+constants.password
> z = base64.encodestring(s)[:-1] # strip trailing 12
> opener.addheaders.append(('Authorization', 'Basic %s' % z))
> self.http_headers = {'Authorization':'Basic %s' % z}
> self.opener = opener
> # also create an xmlrpc Server object
>
> xmlrpc_uri = '%s%s:%s@%s:%d%s' % (
> 'http://',
> constants.userid,
> constants.password,
> constants.host,
> constants.port,
> constants.xmlrpc_base_path
> )
> self.xmlrpc = xmlrpclib.Server(xmlrpc_uri)
>
> def executeQuery(self, xquery, params={}):
> '''Execute an xquery string, return session and summary
> information''' xquery=xmlrpclib.Binary(xquery)
> id = self.xmlrpc.executeQuery(xquery, params)
> summary = self.xmlrpc.querySummary(id)
> return id,summary
>
> def release(self,id):
> ''' Release an executeQuery session '''
> self.xmlrpc.releaseQueryResult(id)
>
> def retrieve(self,id,pos,params={}):
> ''' Retrieve a specific document from an executeQuery result set
> ''' return self.xmlrpc.retrieve(id,pos,params).data
>
> def executeChunkedQuery(self,query,start,number,params={}):
> ''' Execute a query, return a specific part of the result set, and
> dump the session automagically '''
> r=self.xmlrpc.query(query,number,start,params)
> return r
>
> And all the methods work except the last which crashes when called with
> returns
> File "eXistInterface.py", line 58, in executeChunkedQuery
> r=self.xmlrpc.query(query,number,start,params)
> File "/usr/lib/python2.4/xmlrpclib.py", line 1096, in __call__
> return self.__send(self.__name, args)
> File "/usr/lib/python2.4/xmlrpclib.py", line 1383, in __request
> verbose=self.__verbose
> File "/usr/lib/python2.4/xmlrpclib.py", line 1147, in request
> return self._parse_response(h.getfile(), sock)
> File "/usr/lib/python2.4/xmlrpclib.py", line 1286, in _parse_response
> return u.close()
> File "/usr/lib/python2.4/xmlrpclib.py", line 744, in close
> raise Fault(**self._stack[0])
> xmlrpclib.Fault: <Fault 0: 'java.lang.NoSuchMethodException:
> org.exist.xmlrpc.RpcAPI.query(org.exist.security.User, java.lang.String)'>
>
> Which implies the method doesn't exist (although it does in the docs for
> this version ...)
>
> Any ideas? Which piece of basic stupidity am I exhibiting?
>
> Bryan
>
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Exist-open mailing list
> Exi...@li...
> https://lists.sourceforge.net/lists/listinfo/exist-open
|