Codesnip: Ping Weblogs.com Using XMLRPC and VB.NET
4/2/2005 2:55:02 PM
Short code snippet showing you how to create a ping mechanism to ping Weblogs.com or use the code to ping another RSS aggregater.
My starting point was from aspZone.com and John Lewis' blog. This pointed me to Cook Computing their XML-RPC.Net library. Well anyway here's the code:
First I created a new class for my directory for handling the XML-RPC methods. The code is similar to John's code, but in VB.
Imports CookComputing.XmlRpc Imports System Public Class RDMWeblogsDB Public Function Ping(ByVal WeblogName As String, ByVal WeblogURL As String) As WeblogsUpdateResponse Dim proxy As IWebLogsUpdate proxy = XmlRpcProxyGen.Create(GetType(IWebLogsUpdate)) Return proxy.Ping(WeblogName, WeblogURL) End Function Structure WeblogsUpdateResponse Public flerror As Boolean Public message As String End Structure <XmlRpcUrl("http://rpc.weblogs.com/RPC2")> Public Interface IWebLogsUpdate <XmlRpcMethod("weblogUpdates.ping")> Function Ping(ByVal WeblogName As String, ByVal WeblogURL As String) As WeblogsUpdateResponse End Interface End Class
Then in my edit class I just call the class in an onClick event:
Private Sub cmdPingWeblogs_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdPingWeblogs.Click Dim objPing As New RDMWeblogsDB Dim sResponse As DotNetNuke.RDMWeblogsDB.WeblogsUpdateResponse sResponse = objPing.Ping("WWWCoder.com - ASP.Net Tutorials", http://www.wwwcoder.com/main/) lblStatus.Text = sResponse.message End Sub
|