How To Make an XML-RPC Call
By: Scott Watermasysk
Published: 12/11/2002
I never thought I would have gotten as many comments about my little weblog. I was
thinking at one point of making all of TripleASP’s source code available, but I think in the
short run, I am going to put together a small downloadable weblog, so look for that
hopefully by the end of the year.
In the mean time, I know there are a bunch of you writing your own weblog’s at the
moment. In my brief weblogging life time, I have learned a little about XML-RPC. To be
honest, I don’t know too much about it yet, but I did find a pretty nifty library to help
make XML-RPC calls almost a no-brainer. Charles Cook's CookComputing
As a quick example, the downloadable code below will illustrate how to notify
[Link] that you have made an update to your blog.
The WeblogsNotificationProxy
using System;
using [Link];
namespace [Link]
{
/// <summary>
/// Summary description for WeblogsNotificatinProxy.
/// </summary>
[XmlRpcUrl("[Link]
public class WeblogsNotificatinProxy : XmlRpcClientProtocol
{
public WeblogsNotificatinProxy()
{
private string errormessage = "No Error";
public string ErrorMessage
{
get{return errormessage;}
}
public bool Ping(string name, string url)
{
bool result = false;
try
{
XmlRpcStruct rpcstruct = Notifiy(name,url);
if([Link]("flerror"))
{
//[Link] return false if there is no error
//I want to return true, indicating a successful notification
result = !(bool)rpcstruct["flerror"];
if(!result)
{
if([Link]("message"))
{
errormessage = (string)rpcstruct["message"];
}
else
{
errormessage = "Unknown Error";
}
}
}
}
catch(Exception ex)
{
errormessage = "Error: " + [Link];
}
return result;
[XmlRpcMethod("[Link]")]
public XmlRpcStruct Notifiy(string name, string url)
{
return (XmlRpcStruct) Invoke("Notifiy",new object[] {name,url});
}
}
}
The Implementation
WeblogsNotificatinProxy wp = new WeblogsNotificatinProxy();
if([Link]("[Link] and Me","[Link]
{
[Link] = "Weblogs was notified and accepted";
}
else
{
[Link] = [Link];
}
Questions? Comments? Contact me at: Contact Copyright © 2001
[Link]. All rights reserved. Your Privacy