Dashboard > blojsom > ... > Users Guide > XML-RPC
  blojsom Log In   View a printable version of the current page.  
  XML-RPC
Added by David Czarnecki, last edited by David Czarnecki on May 24, 2005  (view change)
Labels: 
(None)

XML-RPC stands for remote procedure call over XML and through specific implementations of blog editing APIs, it allows you to edit your blog remotely.

Installation and default configuration for the XML-RPC APIs

An XML-RPC servlet is included with blojsom that provides support for the Blogger 1.0 API, MetaWeblog API, and MovableType API. The XML-RPC servlet is configured through the /WEB-INF/web.xml file.

Edit the contents of an individual /WEB-INF/(blog-id)/authorization.properties to setup all the valid username/password pairs to control who can post via XML-RPC. That's all there is to setting up XML-RPC support.

To send a message to the service, point your blogger tool or XML-RPC client at the XML-RPC URL. The following URL would apply if you deploy blojsom in its own context:

http://your.blog.com/blojsom/xmlrpc/blog-id/

The following URL would apply if you deploy blojsom in the root context:

http://your.blog.com/xmlrpc/blog-id/

Replace your.blog.com with the url for your blog and get blogging! We also have a page on setting up blojsom to work with various blogging clients.

Setting a default XML-RPC handler

A special key, $default is used to specify which of the registered XML-RPC handlers will be used as the default XML-RPC handler if one is not specified in an XML-RPC call. For example, the following shows what the /WEB-INF/xmlrpc.properties looks like where the default XML-RPC handler is set to the Blogger API handler.

#
# blojsom XML-RPC API Handlers
#
blogger=org.blojsom.extension.xmlrpc.handlers.BloggerAPIHandler
metaWeblog=org.blojsom.extension.xmlrpc.handlers.MetaWeblogAPIHandler
mt=org.blojsom.extension.xmlrpc.handlers.MovableTypeAPIHandler
$default=blogger

Writing a custom XML-RPC handler

If you are writing a custom XML-RPC handler for blojsom, you must write your class to implement the AbstractBlojsomAPIHandler interface. Take a look at the source code for the BloggerAPIHandler and the MetaWeblogAPIHandler to see how it's done.

Registering a custom XML-RPC handler

To register your custom XML-RPC handler with blojsom, you must modify the /WEB-INF/xmlrpc.properties file. The name of this file can be configured via the blog-xmlrpc-configuration initialization parameter in your /WEB-INF/web.xml file.

The contents of the file looks similar to the following:

#
# blojsom XML-RPC API Handlers
#
blogger=org.blojsom.extension.xmlrpc.handlers.BloggerAPIHandler
metaWeblog=org.blojsom.extension.xmlrpc.handlers.MetaWeblogAPIHandler
mt=org.blojsom.extension.xmlrpc.handlers.MovableTypeAPIHandler
$default=blogger

You simply register a particular API handler under a given name. In the first case above, the "blogger" API handler is handled by the org.blojsom.extension.xmlrpc.handlers.BloggerAPIHandler class.

Notes on Blogger API 1.0 Handler

The Blogger API 1.0 does not handle categories. Because of this, blojsom returns each category as a separate blog for the getUsersBlogs() call.

Blogger API Permission

As of blojsom 2.23, users must have the global permission or the post_via_blogger_api permission to use the Blogger API.

Notes on MetaWeblog API Handler

The MetaWeblog API supports file uploads through its newMediaObject method. You can change the allowed MIME types that you are allowed to upload using this MetaWeblog API method by changing the blojsom-extension-metaweblog-accepted-types property in your individual /WEB-INF/blog-id/blog.properties file.

For example:

blojsom-extension-metaweblog-accepted-types=image/jpeg, image/jpg, image/gif, image/png, img

This would allow you to upload JPG, GIF, PNG, and other image types to your blog.

As of blojsom 2.19:

  • The MetaWeblog API handler will look for the <categories> member that gets passed in the data structure sent to the handler when posting an entry. If available, the handler will use the first category in this structure as the category in which to post the entry. Otherwise, the handler will fallback to the blog ID passed to the method to post the entry.
Metaweblog API Permission

As of blojsom 2.23, users must have the global permission or the post_via_metaweblog_api permission to use the MetaWeblog API.

Notes on MovableType API Handler

As of blojsom 2.20, a MovableType API handler is included with blojsom.

MovableType API Permission

As of blojsom 2.23, users must have the global permission or the post_via_movabletype_api permission to use the MovableType API.

Site running on a free Atlassian Confluence Open Source Project License granted to blojsom. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators