HI
I'm a drupal newbie, and have seached for documentation on xmlrpc but there does not seem to be that much, couldn't find any for Java clients.
I am attempting to call system.listmethods from a Java client, the response i get from Drupal is just the header, with 0 content. See below. The java client i am using is Apache xmlrpc-3.0. Does anyone have any ideas, should I use a different Java client. If anyone coupld point me in the direction of some documentation on this I would highly appreciate it, Thanks,
This is the response i get with xmlrpc enabled in Modules admin screen, and calling system.listmethods
2007/03/14 23:53:17:031 GMT [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
2007/03/14 23:53:17:031 GMT [DEBUG] header - << "Date: Wed, 14 Mar 2007 23:53:16 GMT[\r][\n]"
2007/03/14 23:53:17:031 GMT [DEBUG] header - << "Server: Apache/2.0.50 (Win32) PHP/5.0.1[\r][\n]"
2007/03/14 23:53:17:031 GMT [DEBUG] header - << "X-Powered-By: PHP/5.0.1[\r][\n]"
2007/03/14 23:53:17:031 GMT [DEBUG] header - << "Set-Cookie: PHPSESSID=c82759abc8d60d8f576366743d23aa3f; expires=Sat, 07-Apr-2007 03:26:36 GMT; path=/[\r][\n]"
2007/03/14 23:53:17:031 GMT [DEBUG] header - << "Expires: Sun, 19 Nov 1978 05:00:00 GMT[\r][\n]"
2007/03/14 23:53:17:031 GMT [DEBUG] header - << "Last-Modified: Wed, 14 Mar 2007 23:53:16 GMT[\r][\n]"
2007/03/14 23:53:17:031 GMT [DEBUG] header - << "Cache-Control: no-store, no-cache, must-revalidate[\r][\n]"
2007/03/14 23:53:17:031 GMT [DEBUG] header - << "Cache-Control: post-check=0, pre-check=0[\r][\n]"
2007/03/14 23:53:17:031 GMT [DEBUG] header - << "Content-Length: 0[\r][\n]"
2007/03/14 23:53:17:031 GMT [DEBUG] header - << "Content-Type: text/html; charset=utf-8[\r][\n]"
2007/03/14 23:53:17:062 GMT [DEBUG] HttpMethodBase - Cookie accepted: "$Version=0; PHPSESSID=c82759abc8d60d8f576366743d23aa3f; $Path=/"
2007/03/14 23:53:17:109 GMT [DEBUG] HttpMethodBase - Resorting to protocol version default close connection policy
2007/03/14 23:53:17:109 GMT [DEBUG] HttpMethodBase - Should NOT close connection, using HTTP/1.1
2007/03/14 23:53:17:109 GMT [DEBUG] HttpConnection - Releasing connection back to connection manager.
[Fatal Error] :1:1: Premature end of file.
Exception in thread "main" org.apache.xmlrpc.client.XmlRpcClientException: Failed to parse servers response: Premature end of file.
Strangely if i disable the xmlrpc service in Modules admin screen i get the following (dump), however the parser reports an exception (see end of dump)
2007/03/14 23:49:21:250 GMT [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
2007/03/14 23:49:21:250 GMT [DEBUG] header - << "Date: Wed, 14 Mar 2007 23:49:20 GMT[\r][\n]"
2007/03/14 23:49:21:250 GMT [DEBUG] header - << "Server: Apache/2.0.50 (Win32) PHP/5.0.1[\r][\n]"
2007/03/14 23:49:21:250 GMT [DEBUG] header - << "X-Powered-By: PHP/5.0.1[\r][\n]"
2007/03/14 23:49:21:250 GMT [DEBUG] header - << "Set-Cookie: PHPSESSID=391bd26b20d29e89cefcbc823ce859da; expires=Sat, 07-Apr-2007 03:22:40 GMT; path=/[\r][\n]"
2007/03/14 23:49:21:250 GMT [DEBUG] header - << "Expires: Sun, 19 Nov 1978 05:00:00 GMT[\r][\n]"
2007/03/14 23:49:21:250 GMT [DEBUG] header - << "Last-Modified: Wed, 14 Mar 2007 23:49:20 GMT[\r][\n]"
2007/03/14 23:49:21:250 GMT [DEBUG] header - << "Cache-Control: no-store, no-cache, must-revalidate[\r][\n]"
2007/03/14 23:49:21:250 GMT [DEBUG] header - << "Cache-Control: post-check=0, pre-check=0[\r][\n]"
2007/03/14 23:49:21:250 GMT [DEBUG] header - << "Connection: close[\r][\n]"
2007/03/14 23:49:21:250 GMT [DEBUG] header - << "Content-Length: 391[\r][\n]"
2007/03/14 23:49:21:250 GMT [DEBUG] header - << "Content-Type: text/xml[\r][\n]"
2007/03/14 23:49:21:296 GMT [DEBUG] HttpMethodBase - Cookie accepted: "$Version=0; PHPSESSID=391bd26b20d29e89cefcbc823ce859da; $Path=/"
2007/03/14 23:49:21:343 GMT [DEBUG] content - << "<"
2007/03/14 23:49:21:343 GMT [DEBUG] content - << "?"
2007/03/14 23:49:21:343 GMT [DEBUG] content - << "x"
2007/03/14 23:49:21:343 GMT [DEBUG] content - << "m"
2007/03/14 23:49:21:343 GMT [DEBUG] content - << "l version="1.0"?>[\n]"
2007/03/14 23:49:21:343 GMT [DEBUG] content - << "
2007/03/14 23:49:21:359 GMT [DEBUG] content - << "ponse>[\n]"
2007/03/14 23:49:21:359 GMT [DEBUG] content - << " [\n]"
2007/03/14 23:49:21:359 GMT [DEBUG] content - << " [\n]"
2007/03/14 23:49:21:359 GMT [DEBUG] content - << " [\n]"
2007/03/14 23:49:21:359 GMT [DEBUG] content - << " [\n]"
2007/03/14 23:49:21:359 GMT [DEBUG] content - << " faultCode[\n]"
2007/03/14 23:49:21:359 GMT [DEBUG] content - << " -32601[\n]"
2007/03/14 23:49:21:359 GMT [DEBUG] content - << " [\n]"
2007/03/14 23:49:21:359 GMT [DEBUG] content - << " [\n]"
2007/03/14 23:49:21:359 GMT [DEBUG] content - << " faultString[\n]"
2007/03/14 23:49:21:359 GMT [DEBUG] content - << " Server error. Requested method system.listmethods not specified.[\n]"
2007/03/14 23:49:21:359 GMT [DEBUG] content - << " [\n]"
2007/03/14 23:49:21:359 GMT [DEBUG] content - << " [\n]"
2007/03/14 23:49:21:359 GMT [DEBUG] content - << " [\n]"
2007/03/14 23:49:21:359 GMT [DEBUG] content - << " [\n]"
2007/03/14 23:49:21:359 GMT [DEBUG] content - << "[\n]"
With the above return i get following exception...
Caused by:
org.xml.sax.SAXParseException: Unexpected start tag in atomic element: em
Thanks in advance for anyhelp....
blowfish99
Comments
xmlrpc
It's system.listMethods. Does it work now? (but it should return some content even if the spelling is incorrect.)
What do you mean? What do you disable exactly?
Wow hey, result, I switched
Wow hey, result,
I switched the m to a M, and then disable the service, and strangely it works. If I enable the service I get zero body length.
By disable the service I mean I go into the Admin account and then into Administer / Site Building / Modules screen.
On this screen there is a XMLRPC Server Description = "Provides an XMLRPC Server" (under Services - Server), if I untick the check box it works.
I'm pretty sure this module is the http://drupal.org/project/services module, which i probably downloaded in the past thinking it was required for xmlrpc - which i assume it is not. Looking at the notes on the services page it does state XMLRPC Server included. Is this different to the default xmlrpc server provided? Is there a default. Is there a compatibilty problem?
...
No, it's not required. Drupal has built-in xmlrpc.
No :-) It states "XMLRPC server support is included". Meaning, probably, that it describes to Drupal the services it provides so that Drupal exports them via xmlrpc.
I had a quick look at that module and I think I've found the problem. Look here. The programmer had a typo, fixed a month ago, in the function that tells Drupal's xmlrpc mechanism about the services it provides. So Drupal probably chocked on this when you accessed the 'xmlrpc.php' URL. I'm sure that if you examine your watchdog log you'll find some PHP errors.
It's strange that drupal doesn't print the error as an XML document. That's why your parser complains. This may be a bug in drupal. Are you using the most recent version of drupal?
xmlrpc
When i corrected my files with the bug you mentioned the method worked fine, with the xmlrpc server module enabled.
I checked out the watchdog log and there are no php errors related to this issue in there, I haven't noticed anywhere where i can set the log level, so i presume its at max logging?
I am using Drupal 5.0, when there is an error response the parser is choking on the < em > around system.listmethods. I'm wondering if i need to enable extensions in the apache xmlrpc parser.
Also the module name is a little confusing/ambiguous, i.e. its not the xmlrpc server rather switches on support for xmlrpc for that service.
Anyway thanks for your help, i guess i need to upgrade my installation now and do some reading...