Hi ,
i am developing an app using c# .
This app displays the list of all nodes using the taxonomy.selectNodes method.
I am having problem displaying the list of all nodes for any taxonomy
it gives the following error:
==================================================================
response contains string value where array expected [response]
OK
==================================================================
the data structure is mapped as follows:
[XmlRpcMissingMapping(MappingAction.Ignore)]
public struct taxo_selectednodes
{
public string nid;
public string type;
public string uid;
public string status;
public string promote;
public string sticky;
public string title;
public string body;
public string teaser;
public string name; // posted by user name
//public taxonomy taxonomy;
}
public struct Drupal
{
public taxo_selectednodes ts;
}
and then the code is :
============================================================================
[XmlRpcMethod("taxonomy.selectNodes")]
Global_Drupal.taxonomy_selectnodes.Drupal[] Taxonomy_selectNodes(string Hash, string domain_name, string Timestamp, string nonce, string sessid, string tid);
============================================================================
============================================================================
Global_Drupal.taxonomy_selectnodes.Drupal[] lgn;
public taxonomy_selectnodes.Drupal[] taxonomy_selectNodes(string tid, string sessid)
{
Global_Drupal.drupal_global global = new drupal_global();
try
{
Global_Drupal.IServiceSystem iss = XmlRpcProxyGen.Create<IServiceSystem>();
iss.Url = global.rpcserver;
string timestamp = global.GetUnixTimestamp();
string nonce = global.GetNonce(10);
string domain_name = global.domain_name;
string key = global.key;
StringBuilder sb = new StringBuilder();
sb.Append(timestamp);
sb.Append(";");
sb.Append(domain_name);
sb.Append(";");
sb.Append(nonce);
sb.Append(";");
sb.Append("taxonomy.selectNodes");
string hash = global.GetHMAC(sb.ToString(), key);
lgn = iss.Taxonomy_selectNodes(hash, domain_name, timestamp, nonce, sessid, tid);
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("error ! \n" + ex.Message);
}
return lgn;
}
and then the code for click event is
private void List_Nodes_click(object sender, RoutedEventArgs e)
{
try
{
_NodeCollection.Clear();
Global_Drupal.drupal_global global = new Global_Drupal.drupal_global();
Global_Drupal.IServiceSystem iss = XmlRpcProxyGen.Create<IServiceSystem>();
iss.Url = global.rpcserver;
Global_Drupal.drupal_login.Drupal cnct = iss.Connect();
string username = global.username;
string pass = global.pass;
Global_Drupal.drupal_login login = new Global_Drupal.drupal_login();
Global_Drupal.drupal_login.Drupal lgn = new Global_Drupal.drupal_login.Drupal();
lgn = login.login(username, pass, cnct.sessid);
TaxonomyData taxo = taxonomytree.SelectedItem as TaxonomyData;
if (taxo.Tid != "0")
{
System.Windows.Forms.MessageBox.Show("Please wait while the node list is being populated for Tid = " + taxo.Tid);
Global_Drupal.taxonomy_selectnodes ts = new Global_Drupal.taxonomy_selectnodes();
Global_Drupal.taxonomy_selectnodes.Drupal[] lgn_1 = ts.taxonomy_selectNodes(taxo.Tid, lgn.sessid);
for (int i = 0; i < lgn_1.Length; i++)
{
_NodeCollection.Add(new NodeData
{
nid = lgn_1[i].ts.nid,
type = lgn_1[i].ts.type,
uid = lgn_1[i].ts.uid,
status = lgn_1[i].ts.status,
promote = lgn_1[i].ts.promote,
sticky = lgn_1[i].ts.sticky,
title = lgn_1[i].ts.title,
teaser = lgn_1[i].ts.teaser,
name = lgn_1[i].ts.name,
//taxonomy = lgn_1[i].ts.taxonomy.taxo,
});
}
}
else if (taxo.Tid == "0")
{
System.Windows.Forms.MessageBox.Show("Please select a taxonomy");
}
//System.Windows.Forms.MessageBox.Show(""+taxonomytree.SelectedValue);
//System.Windows.Forms.MessageBox.Show(""+taxonomytree.SelectedItem);
//System.Windows.Forms.MessageBox.Show("" + taxonomytree.Items.IndexOf(taxonomytree.SelectedItem));
//taxonomytree.Items.Remove(taxonomytree.SelectedItem);
//taxonomytree.Items.RemoveAt(taxonomytree.Items.IndexOf(taxonomytree.SelectedItem));
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show("" + ex.Message);
}
}
============================================================================
however i am able to use other functions successfully
like:system.connect, user.login, user.get, user.save, user.save, user.delete , search.users , node.get , node.save , taxonomy.getTree,
but i am having problems in "taxonomy.selectNodes"
I am able to fetch the taxonomy tree but when i am trying the display of nodes for a selected taxonomy i am getting this error.
when i try the online tool to fetch the "taxonomy.selectNodes" for a selected taxonomy i am getting this error.
seems like i am unable to map the datastructure correctly
The data structure returned by "taxonomy.selectNodes" in the web browser is like this:
Array
(
[0] => stdClass Object
(
[nid] => 5
[type] => page
[language] =>
[uid] => 1
[status] => 1
.................
)
[1] => stdClass Object
(
[nid] => 4
[type] => page
[language] =>
[uid] => 1
[status] => 1
.................
)
Can anyone tell me what is the correct way to map the data structure in the program
Plz help
its urgent!!