Closed (fixed)
Project:
Services
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 Jun 2009 at 18:43 UTC
Updated:
13 Jun 2009 at 19:47 UTC
Hi,
I'm trying to use the node.save service method using XML-RPC from a Groovy application. I have Key Authentication enabled. I'm able to retrieve nodes using the node.get method.
The XML-RPC request i'm sending is:
POST /~james/drupal/services/xmlrpc HTTP/1.1
Content-Length: 790
Content-Type: text/xml
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Java/1.5.0_16
Host: 192.168.1.101:8080
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
<?xml version="1.0" encoding="ISO-8859-1"?>
<methodCall>
<methodName>node.save</methodName>
<params>
<param>
<value>
<string>cfde2b5cef02976c0e4c33180edfe913e31ef8a6694474037bb93dccaf87b025</string>
</value>
</param>
<param>
<value>
<string>localhost</string>
</value>
</param>
<param>
<value>
<string>1244312624325</string>
</value>
</param>
<param>
<value>
<string>87d1251c-e5b0-46b3-99c0-854b5b3e3dae</string>
</value>
</param>
<param>
<value>
<string>ak7tea4g1p0abquvkjs0f9vnc7</string>
</value>
</param>
<param>
<value>
<struct>
<member>
<name>type</name>
<value>
<string>Story</string>
</value>
</member>
<member>
<name>body</name>
<value>
<string>Hello</string>
</value>
</member>
<member>
<name>title</name>
<value>
<string>World</string>
</value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
The response i'm getting back is:
HTTP/1.1 200 OK
Date: Sat, 06 Jun 2009 18:23:45 GMT
Server: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.7l DAV/2 PHP/5.2.9
X-Powered-By: PHP/5.2.9
Set-Cookie: SESS5c72c03448fbc2a356ff1d17c6723e0a=okv96gobm6dufgqvqiq2qm7lc5; expires=Mon, 29-Jun-2009 21:57:05 GMT; path=/
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Sat, 06 Jun 2009 18:23:45 GMT
Cache-Control: store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0
Connection: close
Content-Length: 313
Content-Type: text/xml
<?xml version="1.0"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value>
<int>1</int>
</value>
</member>
<member>
<name>faultString</name>
<value>
<string></string>
</value>
</member>
</struct>
</value>
</fault>
</methodResponse>
A log message is being reported. It says:
Object of class stdClass could not be converted to string in /Users/james/Sites/drupal/sites/all/modules/services/servers/xmlrpc_server/xmlrpc_server.module on line 58.
Also, when I try to use the services testing page for node.save using the JSON string {"type":"Story","title":"Hello World","body":"Hello World Body"} I get a blank page and the request is not processed.
Any help is gratefully appreciated.
Cheers.
Comments
Comment #1
marcingy commentedThe browser element is now working. Note the node type should be story not Story. I'm going to mark this as fixed if you are still having issues make a note on this ticket.
Comment #2
parkijp commentedHi marcingy,
Thank you for fixing the browser. That is now working great. I'm still struggling to get the service call to work from my application.
I've tried a number of different inputs. The first is using a JSON string. Is there a way to tell the service you are sending it JSON?
This second uses the struct but this time the type parameter is story.
Both the above fail in the same way as before.
Are there other parameters i'm missing in my request? Does the structure of the request look appropriate?
Is it possible to improve the error messages?
Thank you for working so hard on this and for your fast responses.
Kind regards.
Comment #3
parkijp commentedMy fault. I've figured out what I got wrong. I was passing the wrong method name to the hash, which is why it worked great for node.get but not node.save.
Thanks for looking into this and for your help.
Cheers.
Comment #4
marcingy commented