Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create XmlRpcUrl Interface at runtime

Currently I'm creating my XML-RPC using (xml-rpc.net) interfaces statically with the following statement:

[XmlRpcUrl("http://dillieodigital.wordpress.com/xmlrpc.php")]
public interface ICSBlog : IMetaWeblog
{
}

However, I'd like to be able to specify the URL for the service at runtime, so I can dynamically switch to different services as needed.

How would I go about doing this?

like image 215
Dillie-O Avatar asked Nov 06 '10 04:11

Dillie-O


1 Answers

The URL can be set at runtime, for example:

ISumAndDiff proxy = XmlRpcProxyGen.Create<ISumAndDiff>();
proxy.Url = "http://www.cookcomputing.com/SumAndDiff.rem";   
SumAndDiffValue ret = proxy.SumAndDifference(2, 3);

This assumes the proxy interface derives from IXmlRpcProxy. If not, you have have to cast to IXmlRpcProxy to set the Url property.

like image 159
Charles Cook Avatar answered Oct 08 '22 03:10

Charles Cook