The Cook Computing blog has a post discussing how dynamics in .NET 4 could be used to create dynamic RPC calls. (Post: ALTERNATIVE SYNTAX FOR MEMBER CALLS ON C# DYNAMIC TYPES )
The post shows the following example:
using System.Dynamic;
class XmlRpcClient : DynamicObject
{
string endpoint;
public XmlRpcClient(string endpoint)
{
this.endpoint = endpoint;
}
public object Invoke(string methodName, object[] args)
{
return 5; // actually make call to XML-RPC endpoint here
}
public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args,
out object result)
{
result = Invoke(binder.Name, args);
return true;
}
}
The part I don't understand is the comment stating "actually make call to XML-RPC endpoint here".
Is there a way to use the XML-RPC.NET library in the invoke method or would you need to make a HttpWebRequest call?
Thanks
When I wrote the post "Alternative Syntax…" dynamic support in C# had only just been announced so I was just describing a possible implementation to take advantage of these new features.
Implementing "actually make call to XML-RPC endpoint here" would require a call to the XmlRpcClientProtocol class though this class would need some minor modifications to be used in this way.