This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

Here's an idea: Let's define an XML-RPC or SOAP interface to Wiki. I don't exactly know what we could do with it, but at least we could do things like:

  • Automatical notification of page changes (someone would need to write a script that would check the RecentChanges, then email anyone.
  • Combining Wikis in a manner more efficient than InterWiki.

This would save us from actually requiring to implement all sorts of features into JSPWiki itself, and allow people to make their own modular thingies.


I'm thinking of the following interfaces:

  • getRecentChanges( long timestamp ): Get list of changed pages since timestamp.
  • getPage( String pagename, int version ): Get the raw Wiki text of page.
  • getPageText( String pagename, int version ): Get page data rendered as plain text, with most of formatting removed (this should be really good for when you actually send wiki pages via email or something).
  • getPageHTML( String pagename, int version ): Return page in rendered HTML. This is of course required because you can never know how the WikiText should be applied, since it varies from Wiki to Wiki.

I don't know whether writing would be such a good idea. But with these you could get somewhere anyway.


That's a very interesting thought. It allows any outside process to monitor and perform actions based on the current state of the Wiki, but without actually affecting the Wiki.

As specified above, the only way to get a list of pages is getRecentChanges(). It seems a bit limiting to think that all the other process would care about is recently changed files. What about:

  • getAllPages(): Get list of all Wiki pages.
  • getMatchingPages(String query): Get list of all Wiki pages that match the query. Of course, this then begs the question of what matching means. That's kind of annoying.

getMatchingPages() may be overkill. Perhaps these queries would be better implemented with a SOAPProvider, a WikiPageProvider based on SOAP. Then the matching SOAP service can store the files anyway it likes, be notified the instant that a page is stored, and query the page text any silly way it feels like. A SOAPProvider would also get around the limitation that the API specified above requires the interested party to "poll" the WikiEngine periodically. With a SOAPProvider, if you care about every save or read, you can track them yourself.


This was almost too easy. JSPWiki 1.6.6-cvs now supports an XML-RPC interface at URL (note the trailing slash).

To try this one out, go download the Apache XML-RPC package from, then type in the following command:

java -cp xmlrpc.jar org.apache.xmlrpc.XmlRpcClient jspwiki.getPage Main

See below for the available methods.

(NB: You can't use the command line to get RecentChanges, you'll have to write a script of your own.)

Please test this and see how it works out.


Nifty! Works really well.

My only quibble is that you allow me to ask by specific version, but i have no idea what versions are acually available. It's current behavior is nice in that if I use a non-existant version number it just uses the most recent, but wouldn't a call like:

  • int getLatestVersion(String pagename)
help? Just so my program don't have to guess at version numbers.

In fact, could you add a version number to the struct that getRecentChanges() returns? Then an email alerting program could diff between the oldest and the current within the time period, since a page may have changed multiple times in the time period requested (I know i have a tendancy to save a page, and then immediately have another thought).

I agree on using XML-RPC. Much nicer. -- MahlenMorris

You can use just plain getPage( string ) to get the latest version.


The getPageInfo() method has been implemented now. The current API looks thus like this:

  • getRecentChanges( Date timestamp ): Get list of changed pages since timestamp. The result is an array, where each element is a struct:
    • name (string) : Name of the page.
    • lastModified (date) : Date of last modification.
    • author (string) : Name of the author (if available).
    • version (int) : Current version.
  • getPage( String pagename ): Get the raw Wiki text of page, latest version.
  • getPage( String pagename, int version ): Get the raw Wiki text of page.
  • getPageHTML( String pagename ): Return page in rendered HTML.
  • getPageHTML( String pagename, int version ): Return page in rendered HTML.
  • getAllPages(): Returns a list of all pages. The result is an array of strings.
  • struct getPageInfo( string pagename ) : returns a struct with elements
    • name (string): the canonical page name
    • lastModified (date): Last modification date
    • version (int): current version
    • author (string): author name
  • struct getPageInfo( string pagename, int version ) : returns a struct just like plain getPageInfo(), but this time for a specific version.

There is still a known problem with Date handling... It should probably be UTC, but at the moment all times seem to be local time.


Two problems:

  1. Date handling.
  2. UTF-8.

First, dates: The XML-RPC spec has no way to specify the timezone. Which means that you actually would have to know the timezone in which the server resides... And which also means that the XML-RPC client can use whatever timezone it likes to interpret the incoming message. And that ain't fun. We could of course

  • a) Just send an int meaning seconds of UTC since EPOCH,
  • b) Send a long disguised as a String meaning milliseconds of UTC since EPOCH,
  • c) Send a ISO format String as the date, or
  • d) Try to figure out a way to talk UTC under XML-RPC.

Second, sending UTF-8. XML-RPC spec says "ASCII". Which sucks, again. Sending ISO-8859-1 seems to work, but is there any guarantee that the recipient can talk UTF-8? And how would he know the incoming character set? Or would that be the responsibility of the XML parser?

At the moment the Apache XML-RPC library seems to use Latin1 ONLY. The euro sign (€) gets killed on the way, as are all UTF-8 characters.


More updates. The UTF-8 issue seems to be talked to the death on the XMLRPC mailing list. The summary seems to be: "While many toolkits might support something else than ASCII in string values, the XML-RPC spec is frozen, and will never change. If you transport something else than ASCII, you're in violation of the spec. Use base64."

Using base64 would mean that all methods that use strings now, should use base64 (because JSPWiki supports UTF-8 all across the board - in fact even ISO-Latin1 is not supposed to go through XML-RPC strings). Which means more work to the application writer, since he has to encode/decode all stuff going back and forth. Gng. XML-RPC is not person-to-person interoperable - many people are unable to write their own names as strings.

I'm seriously considering SOAP at this point. Or breaking the XML-RPC spec knowingly and willingly; call it WikiRPC or something =). (XML-RPC is a registered trademark of Userland Software).

Date issue is easier, but java.util.Calendar and the XML-RPC library does not make it exactly simple to assume UTC. Need some shifting back and forth.


Be prepared: The API will change in the next release! Return values will be UTF-8 strings wrapped in base64, and input will likely be URL-encoded UTF-8 strings (to be compatible with the JSPWiki URL scheme). --JanneJalkanen

Add new attachment

Only authorized users are allowed to upload new attachments.
« This particular version was published on 01-Feb-2002 14:32 by