XML-RPC ping endpoint in C# and ASP.NET

Tuesday, March 4, 2008 by Mistlee

XML-RPC ping endpoint in C# and ASP.NET

Can't see any images? - !



Visit The XML Pro News Directory
CSS
Templates, Tag Reference
News
Articles, Books
XML Articles
Blogs, Recent News
XML Consultants
Consulting Networks, Training
XML Editors
XML Text Editors, XML WYSIWYG Editors
XML Encoding
Tags, Rules
XML Layouts
Code Layout, Page Layout
XML Programming
Methods, Applications

Submit your site for FREE


Click to Play

SMX West 2008: Danny Sullivan
Mike McDonald of WebProNews had a nice chat with Danny Sullivan during SMX West 2008, in Santa Clara. Search Engine Land's Editor-in-Chief discusses...

Recent Articles

A New Way to Organize Your Feeds
When you come across something interesting on the web, but don't have time to read it at that moment, what do you do?The old way is to add the web page to your browser's bookmarks or favourites so you can retrieve it when you do have time. A more recent method is to...

Google Sitemaps and Competitive Intelligence
I'm a big fan of the Google Webmaster Central Program and using sitemaps. I agree that you should build your website so that it is crawlable and not rely on sitemaps to compensate for poor site architecture, but...

A Milestone for XBRL
This could be a milestone in illustrating the benefits of using XBRL for companies filing financial data.Last week, Microsoft submitted a Form 8-K filing to the financial data.Last week, Microsoft submitted a Form...

When Is XML Not XML?
Here is a mystery for folks. I've updated my parsing engine for coldfusionbloggers.org. I'm using CFHTTP now so I can check Etag type stuff. I take the result text and save it to a file to be parsed by CFFEED.


03.04.08

XML-RPC ping endpoint in C# and ASP.NET

By Mads Kristensen

All blog platforms send out pings using the XML-RPC protocol whenever a new post is created or an old one is updated. It is very simple to send out XML-RPC pings using C#, because it is just a normal HTTP request with some XML in the request body. See here how to ping using C#.

To send a ping is the client part of the transaction. There must also be a server to intercept the ping – an endpoint. Feedburner is probably the most widely used by blogs at the moment. What happens is that when you write a post, the blog engine sends a ping to Feedburner’s XML-RPC endpoint. In the XML body of the ping request is the URL of your blog so Feedburner knows who sent the ping. It then retrieves your blog’s RSS feed, parses it, and spits it out to your readers. That’s how simple and powerful it is to use XML-RPC pings.

In an earlier post I showed you how to write the ping client, now let’s look at the server or endpoint. The endpoint can be used by any service that needs to be notified whenever content is updated on a website. That goes for all applications that listen to RSS feeds for instance.

The Code

In 100 lines of code including comments, we are able to build an XML-RPC ping server endpoint. All it has to do is to listen for POST requests and parse the XML sent in the request body as shown in my earlier post. By parsing the XML it can find the URL that has been updated. The method HandleUrl is where the URL is passed to and it's from here you write your logic to handle the ping request.

Kickstart Your Mobile Marketing Strategy
Download The Mobile Marketing Handbook

#region Using

using System;
using System.IO;
using System.Net;
using System.Xml;
using System.Web;

0 comments: