Just thinking. If we make TWiki a
WebServices client, we could have an industry standard way of invoking the APIs in TWiki.
- For example, adding attachments to a page. (Though this could also be done with WebDAV)
- Causing a background task to be invoked (such as statistics)
- Getting a web (GetAWebAddOn)
Further,
SoapLite can export a whole OO-perl class as a
WebService. See the examples on
http://guide.soaplite.com
, or the following, completely fictional and not-tested example:
Now, you could use your industry standard
WebServices client or even TWiki, if we implemented
TWikiAsWebServicesClient. Alternatively you can roll your own client:
For (2) getting background tasks invoked:
#!perl -w
use SOAP::Lite;
print SOAP::Lite
-> uri('http://www.soaplite.com/Demo')
-> proxy('http://services.soaplite.com/hibye.cgi')
-> mailUpdatesAndRemoveObsoleteTopicLocks()
Now, assume for a minute that the call to &main() doesn't exist in this:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/twiki/twiki/bin/mailnotify?rev=1.14&content-type=text/vnd.viewcvs-markup
We'd have the following as the server (bits in bold are
WebServices specific, the rest is out of the mailnotify script.)
#!perl -w
use SOAP::Transport::HTTP;
SOAP::Transport::HTTP::CGI
-> dispatch_to('Scheduler')
-> handle;
package Demo;
require 'mailnotify.pl';
sub mailUpdatesAndRemoveObsoleteTopicLocks {
my $dataDir = &TWiki::getDataDir();
opendir( DIR, "$dataDir" ) or die "could not open $dataDir";
@weblist = grep !/^\.\.?$/, readdir DIR;
closedir DIR;
foreach $web ( @weblist ) {
if( -d "$dataDir/$web" ) {
processWeb( $web ); # calls mailnotify.pl/processWeb
# remove obsolete .lock files
&TWiki::Store::removeObsoleteTopicLocks( $web );
}
}
}
Now any client using
UDDI could see that TWiki had appeared in the list of all services available on the network. And you could see that one service was available, to mailUpdatesAndRemoveObsoleteTopicLocks().
--
MartinCleaver - 11 Jun 2001