[dev] Interacting with the horde RPC/SOAP interface
llusca
eric.llusca at gmail.com
Thu Mar 20 16:25:58 UTC 2008
Hi all,
I tried to run the code given in http://wiki.horde.org/XmlRpcPythonHowTo
But it doesn't works.
I'm really beginner in horde
The server is a sme distribution on a nec computer and I even don't know if
xmlrpc is enabled by my horde configuration.
How can I test if xmlrpc if corectly installed ?
What's wrong whith the code ? Connection stay closed, no ? Why ?
(output at the end of the message)
Thanks,
Eric Llusca.
***************
The error correspond to these lines:
url = "%s://%s:%s@%s/rpc.php" % (protocol, username, password, hostname)
print "Connecting to URL '%s'..." % url
server = xmlrpclib.ServerProxy(url, verbose=2)
print "server: "+str(server)
Kalendar = server.kronolith.listCalendars(False, 4)
print "Kalendar: "+str(Kalendar)
print "Retrieving list of calendars..."
error code:
python2.4 testHordeXmlRpc.py
Connecting to URL 'https://user:password@nec/horde/rpc.php'...
server: <ServerProxy for user:password at nec/horde/rpc.php>
send: 'POST /horde/rpc.php HTTP/1.0\r\nHost: nec\r\nAuthorization: Basic
bGx1c2NhdGVzdDpFbGwwNDA3JA==\r\nUser-Agent: xmlrpclib.py/1.0.1 (by
www.pythonware.com)\r\nContent-Type: text/xml\r\nContent-Length:
215\r\n\r\n'
send: "<?xml
version='1.0'?>\n<methodCall>\n<methodName>kronolith.listCalendars</methodName>\n<params>\n\n<value><boolean>0</boolean></value>\n\n\n<value><int>4</int></value>\n\n</params>\n</methodCall>\n"
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Thu, 20 Mar 2008 14:24:43 GMT
header: Server: Apache
header: X-Powered-By: PHP/4.3.9
header: Set-Cookie: Horde=2547670ce2b79421e938b824ee75f5e3; path=/horde;
domain=nec
header: Expires: Thu, 19 Nov 1981 08:52:00 GMT
header: Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
header: Pragma: no-cache
header: Content-Length: 0
header: Connection: close
header: Content-Type: text/html; charset=ISO-8859-1
Traceback (most recent call last):
File "testHordeXmlRpc.py", line 38, in ?
Kalendar = server.kronolith.listCalendars(False, 4)
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 1284, in _parse_response
p.close()
File "/usr/lib/python2.4/xmlrpclib.py", line 530, in close
self._parser.Parse("", 1) # end of data
xml.parsers.expat.ExpatError: no element found: line 1, column 0
*******
Markus Meyer wrote:
>
> Hi everyone,
>
> first thanks for Horde which works very well for me.
>
> I'm asking because I'm trying to communicate with Horde through the RPC
> interface. As a first exercise I wanted to write a small script which
> downloads all Horde calendars to my local hard disk. This way, I can
> look at my calendars in, say, Mozilla Sunbird even if I lose Internet
> connectivity.
>
> I'm using the version of Horde which comes with the last version 8.1.0
> of the "Plesk" server administration tool. This means I'm using Imp H3
> (4.1.3) and Kronolith H3 (2.1.3), if this makes sense.
>
> The idea was to call the "calendar.listCalendars" method which would
> return a list of calendars I have access to, then export those calendars
> using "calendar.exportCalendar". However, when I call
> "calendar.listCalendars", an empty array is returned. I'm using the
> SOAPpy module for python on the client and the XML SOAP exchange looks
> as follows:
>
> *** Outgoing SOAP ******************************************************
> <?xml version="1.0" encoding="UTF-8"?>
> <SOAP-ENV:Envelope
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/1999/XMLSchema">
> <SOAP-ENV:Body>
> <ns1:calendar.listCalendars xmlns:ns1="urn:horde" SOAP-ENC:root="1">
> <owneronly xsi:type="xsd:boolean">False</owneronly>
> <permission xsi:type="xsd:int">2</permission>
> </ns1:calendar.listCalendars>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> ************************************************************************
> *** Incoming SOAP ******************************************************
> <?xml version="1.0" encoding="UTF-8"?>
>
> <SOAP-ENV:Envelope
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:ns4="urn:horde"
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
> <SOAP-ENV:Body>
>
> <ns4:calendar.listCalendarsResponse>
> <output xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[1]"
> xsi:nil="true"/></ns4:calendar.listCalendarsResponse>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> ************************************************************************
>
> I tried to debug this on the server side by listing the content of the
> $calendars variable to the system log in function
> Kronolith::listCalendars(). Interestingly enough, the variable
> $calendars contains all my calendars on return of the function
> Kronolith::listCalendars(). Still the information does not seem to make
> it through into the XML.
>
> I'm pretty sure I have the right permissions because I can actually
> download the calendars (see below).
>
> To check if I can download a calendar, I found out the id of my calendar
> and called "calendar.exportCalendar(id, 'text/calendar')". This indeed
> returns my whole calendar as a vcalendar file inside some XML. But when
> SOAPpy tries to parse this, it says that it isn't well-formed XML. This
> is apparently because the XML contains special chars (like umlauts)
> which are not in UTF-8 (though the <?xml> comment says so). Apparently
> Horde store my umlauts in another encoding but fails to convert those to
> UTF-8 when embedding them in the XML.
>
> Thanks for any help/pointers.
>
>
> Markus
>
>
>
> --
> Horde developers mailing list - Join the hunt: http://horde.org/bounties/
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>
>
--
View this message in context: http://www.nabble.com/Interacting-with-the-horde-RPC-SOAP-interface-tp9031283p16180143.html
Sent from the Horde - Dev mailing list archive at Nabble.com.
More information about the dev
mailing list