11.1 Weblogs

A weblog is a web site with a set of stories, sorted chronologically. Generally speaking, the idea is that it should be extremely easy to post a new story to a weblog, allowing for very natural, seamless writing. Personal weblogs often resemble diaries or journals. Group or corporate weblogs typically serve to allow a group of people with common interests to share thoughts, news, or discuss problems.

The precise definition of a weblog varies. Similarly, there's a huge variety in the software used to run and manage a weblog. Some, like LiveJournal and Blogger, are hosted on a central server. Others are desktop software, and still others are installed on individual personal web servers. There are distinct advantages and disadvantages to each model. For example, LiveJournal offers a "friends" feature that allows you to mark entries as private and only viewable by users on your friends list. Because friends are in turn registered users (i.e., they all have their own journals), it's easy to see how LiveJournal quickly became a popular site. At the other end of the spectrum, desktop software, such as Radio UserLand (http://radio.userland.com/), allows tremendous customization and lets you write posts even if you aren't connected to the Internet.

UserLand was one of the first systems to offer a web service that interfaces with weblogs?born in part out of a desire to offer a scripting system that relied on standard TCP/IP and networking standards instead of proprietary, single-platform systems. The original, pre-SOAP system is known as XML-RPC (http://www.xmlrpc.com/, a site hosted by UserLand).

11.1.1 XML-RPC and Weblogs

XML-RPC is SOAP's stripped down, lighter-weight predecessor. For example, there is no such thing as WSDL in XML-RPC. Instead, developers interested in working with XML-RPC rely on the provided documentation and XML-RPC libraries for their preferred language. Because this application is built with Java, it uses the Apache XML-RPC libraries available from http://ws.apache.org/xmlrpc/ (shown in Figure 11-1).

Figure 11-1. Apache XML-RPC web site

XML-RPC merely provides the mechanism for making a call to a remote server; it doesn't specify anything else about the service. This means that for each system you wish to connect to, you must read and understand the API documentation:

  • LiveJournal (http://www.livejournal.com/doc/server/ljp.csp.xml-rpc.protocol.html)

  • Blogger (http://new.blogger.com/developers/api/1_docs/)

These APIs are pretty different, but as will be shown in this chapter, a single application can address both systems. To isolate the details of the underlying vendor-specific weblog web-service interfaces from the rest of the application's functionality, an interface is used that describes posting a weblog entry in a generic fashion (in some ways, this is analogous to a generic driver interface providing interfaces to multiple data sources). The sample application in this chapter accesses two implementations?one for Blogger and one for LiveJournal.

What About Atom?

As of this writing, LiveJournal, Blogger, and many other weblog software creators have pledged support to a single, unified new weblog API and syndication format (http://www.intertwingly.net/wiki/pie/RoadMap). The idea is that all the various vendors will agree to a single API (replacing the Blogger and LiveJournal APIs, as well as all of the others) and a single syndication format (replacing the various RSS incarnations). A nice side benefit of this is that by ensuring that the API and the syndication format are in sync, it'll make it easier to integrate the two (for example, the API could return data formatted in the syndication format).

The only downside of Atom is that the specification isn't complete, nor is there a timeline for when it will be. Until then, you'll have to rely on an interface with multiple concrete implementations to handle connecting to the various services. When Atom support is available, you'll be able to a use a new, single class to talk to Atom-based services.