Hello,

I'm having some trouble using some CCK form fields, like the date picker dropdown and checkboxes, working with XML-RPC services. In the simplest example, when I load a node with node.load then save it with node.save, I get a validation error. It seems that node.load returns the data in its native format, but node.save expects it to be formatted like a Web form. If I change the fields to simple text fields, everything works fine, except of course that the Web GUI is crappy.

I reported bugs against CCK and Services, but though I would ask here too in case anybody had ideas. Bugs are here:

Does anybody have any suggestions for making this work?

Thanks!

----Scott.

Comments

thompcha’s picture

Hello Scott,

I'm curious if you ever finished your script to address this issue. If so, would you mind sharing it?

scottgifford’s picture

Hi thompcha,

I wrote some custom code using the Services module, which simply took a consistent set of fields from the RPC request and converted them to a node for saving, and took a node and converted it to a consistent set of fields for loading. Basically just some Service RPC calls, and some mundane code for mapping fields between the two different data structures.

Hope this helps!

stillfinder’s picture

Hello!
I have some problem with checkboxes and xmlrpc via services module. I write some application in C# and can't to send checkbox data to services. Maybe someone know in what format data must be sended?

With Date field I sending like this and all work perfect:

private static void AddArrayDateToNode(string fieldname, DateTime dt, XmlRpcStruct node)
        {
            XmlRpcStruct sMainDate = new XmlRpcStruct();
            XmlRpcStruct sDate = new XmlRpcStruct();
            sDate["year"] = dt.Year.ToString();
            sDate["month"] = dt.Month.ToString();
            sDate["day"] = dt.Day.ToString();
            sMainDate["value"] = sDate;
            object[] oDate = new object[] { sMainDate };
            node[fieldname] = oDate;
        }

So we have an array:

-		["field_exclusive_from"]	{object[1]}	
		Key	"field_exclusive_from"	object {string}
-		Value	{object[1]}	object {object[]}
-		[0]	Count = 1	object {CookComputing.XmlRpc.XmlRpcStruct}
-		["value"]	{CookComputing.XmlRpc.XmlRpcStruct}	
		Key	"value"	object {string}
-		Value	Count = 3	object {CookComputing.XmlRpc.XmlRpcStruct}
-		["month"]	"6"	
		Key	"month"	object {string}
		Value	"6"	object {string}
-		["year"]	"2011"	
		Key	"year"	object {string}
		Value	"2011"	object {string}
-		["day"]	"30"	
		Key	"day"	object {string}
		Value	"30"	object {string}

Thanks to all for any help.

stillfinder’s picture

Hi! I found solution for problems with cck fields (checkboxes and date time picker) and xml-rpc services node.save function

datetime cck field you need to send in following format:
[field_date] => Array
(
[0] => Array
(
[value] => Array
(
[year] => 2014
[month] => 7
[day] => 7
)
)
)

and CheckBoxes in this format:
[field_b_material] => Array
(
[value] => Array
(
[1991] => 1991
[1985] => 1985
)
)

Where 1991 is ID of taxonomy term.

If someone interested for C# code I can to send it.