java node.save example anywhere?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
kkretsch's picture

I have a java client up and running using org.apache.xmlrpc.client.XmlRpcClient as client lib and a current drupal 6 with services via xmlrpc enabled. I already can connect, login, logout and even loading a node works.
Authentication is done via sessionID, API-key is disabled.

Now for the problem: i can't get the node.save to work. I give the function two parameters, the session and some structure. What java type equivalent is there expected?

config.setEnabledForExtensions(true);
...
HashMap<String,Object> hmSave = new HashMap<String,Object>();
hmSave.put("type", "pruefsumme");
hmSave.put("title", ivFileList.get(i));
hmSave.put("field_crc32", ivCheckSumListCRC32.get(i));
params = new Object[] {
sessid,
hmSave
};
Object oSave = client.execute(WS_ACTION_SAVE, params);
System.out.println(WS_ACTION_SAVE + "\t" + oSave);

This gives only an exception parsing the servers reply. No error on the server side in any logfile.

The examples I found all use php so please a hint for a java example anywhere?

Comments

Hello Kai, Although i cannot

Dinis's picture

Hello Kai,

Although i cannot help with your specific problem I seeking help in how to connect to a drupal service using Java.

Do you have any code that you can share?

As you say you can "I have a java client up and running using org.apache.xmlrpc.client.XmlRpcClient as client lib and a current drupal 6 with services via xmlrpc enabled. I already can connect, login, logout and even loading a node works." and we have not been able to get as far as this even yet.

You help would be very much appreciated and thanks in advance for your time.

We're running on Drupal 6.9 using JSON.

Kind Regards,
Danielle

working example

kkretsch's picture

Hi Danielle,

sorry for replying so late, but I'm drowning in projects.
I made some code available in sourceforge within the JPruefsumme project.

https://sourceforge.net/projects/pruefsumme
/cvsroot/pruefsumme/JPruefsumme/de/pruefsumme/app/Wsclient.java

Does the connection and at least the non https version does work now.

You can have a look at.

with kind regards.

Example

anAgent's picture

Hi Kai,

You can also find another example on my site: http://molinesoftware.com/?q=content/connecting-drupal-using-java

The example is very simple in that it shows you how to connect, login, and logout.

However, using the logic from my C# project at https://sourceforge.net/projects/drupalxmlrpc/, you should be able to port it to C#.

Regards,

Aaron

how can we do the in java

Sunrises's picture

Hi,
please tell me how can we use "node.save" java