I'm making a webservice that receives as a parameter a name of a node. The service should return the names of the child nodes of that node. Is this possible? How can I get a node from its name? In the webservice I have no notion of CurrentNode so I'm not getting how I should do this.
Consider rewriting the webservice to accept the id of the node, and retrieve a list of child nodes based on that node id (that is, if you're using the standard umbraco webservices);
umbraco webservices can only return a list of child nodes based on a id, so it may take a while to get to the desired node (by comparing the node's name with the parameter returned from your service) if you have to invoke the webservice more than once (especially if you have a deep nested content structure and have to invoke the webservice recursively for each node
Or, consider writing another webservice, hosted in your umbraco instance, that can query the umbraco instance using xpath or linq2umbraco and return a list of child nodes to the caller.
Latter is better solution imho as it only requires a single webservice call which can query the cached content xml pretty fast.
Getting node by its name
Hello,
I'm making a webservice that receives as a parameter a name of a node. The service should return the names of the child nodes of that node. Is this possible? How can I get a node from its name? In the webservice I have no notion of CurrentNode so I'm not getting how I should do this.
Thanks!
Hi prl,
Consider rewriting the webservice to accept the id of the node, and retrieve a list of child nodes based on that node id (that is, if you're using the standard umbraco webservices);
umbraco webservices can only return a list of child nodes based on a id, so it may take a while to get to the desired node (by comparing the node's name with the parameter returned from your service) if you have to invoke the webservice more than once (especially if you have a deep nested content structure and have to invoke the webservice recursively for each node
Or, consider writing another webservice, hosted in your umbraco instance, that can query the umbraco instance using xpath or linq2umbraco and return a list of child nodes to the caller.
Latter is better solution imho as it only requires a single webservice call which can query the cached content xml pretty fast.
Hope this helps.
Regards,
/Dirk
is working on a reply...