Hi guys,
Could somebody help me extracting the response data from XmlRpcStruct in
xml-rpc webservice method call.
I have a xml-rpc webservice which insert/update users and the response
comes as XmlRpcStruct.
Here is how my code look like:
[XmlRpcMissingMapping(MappingAction.Ignore)]
public struct DrupalUser
{
public string uid;
public string username;
public string email;
public string initials;
public string firstname;
public string lastname;
}
[XmlRpcUrl(
http://test.webservice.com/services/xmlrpc
<
http://test.webservice.com/services/xmlrpc> )]
public interface IServiceSystem : IXmlRpcProxy
{
[XmlRpcMethod("user.update")]
XmlRpcStruct update(string hash, string dom, string tmstamp, string non,
DrupalUser[] users);
}
static void Main(string[] args)
{
IServiceSystem iss = XmlRpcProxyGen.Create<IServiceSystem>();
XmlRpcStruct upd = new XmlRpcStruct();
// calling webservice
upd = iss.update(hash, dom, tmstamp, non, u_update);
foreach (DictionaryEntry d in upd)
{
Console.WriteLine(d.Key.ToString() + " : " + d.Value.ToString());
}
}
Output:
Successes: System.Object[]
failures: System.Object[]
Expected output in case of success should be:
successes: [
{uid: 42, username: "adf", email: "
afaf@...
<mailto:
afaf@...> ", firstname: "mr", lastname: "aaba", initials:
"afdfa"},
{uid: 43, username: "another_user", email: "
blah@...
<mailto:
blah@...> ", firstname: "another", lastname: "user"}
]
failures: []
Expected output in case of failure should be:
failures: [{
record: {username: "adf", email: "
afaf@...
<mailto:
afaf@...> ", firstname: "mr", lastname: "aaba", initials:
"afdfa"},
errors: {uid: "User already exists!"}
}]
successes: []
Looking forward to hearing from you.
Thanks.
Zeeshan.
[Non-text portions of this message have been removed]