i need to make a ("webservice") c# app that can create/update/delete nodes for/from drupal 7 using xmlrpc. everytime i run my app i get errors from the xmlrpc files(library). I tried to find code/documentation for C# using xmlrpc to connect to drupal, but in vain. I would be nice if you could point me in the right direction, or share some c# code with me.
{
[XmlRpcUrl("http://testing/testserver")]
public interface IDrupalServices
{
[XmlRpcMethod("node.get")]
XmlRpcStruct NodeLoad(int nid, string[] field);
[XmlRpcMethod("node.save")]
void NodeSave(XmlRpcStruct node);
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
IDrupalServices drupal = XmlRpcProxyGen.Create<IDrupalServices>();
int nid = 227;
string[] fields = new string[] { };
XmlRpcStruct node = drupal.NodeLoad(nid, fields);
string teaser = node["teaser"].ToString();
welcomeTxt.Text = teaser;
}
private void button1_Click(object sender, EventArgs e)
{
string title = txtTitle.Text;
string body = txtBody.Text;
IDrupalServices drupal = XmlRpcProxyGen.Create<IDrupalServices>();
XmlRpcStruct node = new XmlRpcStruct();
node["id"] = 1001;
node["title"] = title;
node["body"] = body;
node["teaser"] = body;
node["format"] = 1;
node["type"] = "webservice";
node["promote"] = false;
drupal.NodeSave(node);
MessageBox.Show("The post was been created!");
}
}
}
一经推算,就犯了错误: 服务器退回了一起过失例外:[32601] 服务器错误。 未具体说明的请购方法。 - 在XmlRpcSerializer.cs
Thank you, Florin