This document offers sample code for accessing Calendar-WS, a Web Services interface to CalAgenda, the shared calendaring system on the University of California, Berkeley campus.
This Java code sample, a class which calls getEventsByRange(), was contributed by Alexander Karapetyan of the Haas School of Business, University of California, Berkeley. It requires the use of the Apache Axis Web Services platform for Java, which is available from the Apache Axis homepage (http://ws.apache.org/axis/).
getEventsByRange() sample code
For a demonstration of how to parse and process the XML results returned, here is a Java class that demonstrates how to read the status of your calls ("success" or "error") from those results. It requires XOM, an open source XML API for Java, version 1.1 or higher, which is available for downloading from the XOM project site (http://freshmeat.net/projects/xom/). You can find documentation for XOM at the XOM homepage (http://www.xom.nu).
GetResult sample code
Several sample Perl scripts are available here, which demonstrate how to call each of the remote procedures in the Calendar-WS interface. These require the use of the SOAP::Lite Web Services toolkit for Perl, which is available from the SOAP::Lite homepage (http://www.soaplite.com) or the Comprehensive Pearl Archive Network (CPAN) (http://www.cpan.org/).
SOAP::Lite requires a number of Perl modules as prerequisites, although most of these modules will be installed when you install SOAP::Lite itself. Notably, to make secure HTTPS (SSL) encrypted connections, SOAP::Lite requires the Crypt::SSLeay module, which is available from Chamas.com (http://www.chamas.com/open_source.htm) or from CPAN, as well as being offered as a (non-default) option when installing SOAP::Lite.
For general instructions on downloading and installing Perl modules from CPAN, please refer to the installation section of the CPAN FAQ (http://www.cpan.org/misc/cpan-faq.html#How_install_Perl_modules).
pingServer() sample code
getEventsByRange() sample code
getEvent() sample code
addEvent() sample code
deleteEvent() sample code
For a demonstration of how to parse and process the XML results returned, here is a Perl script that demonstrates how to read the status of your calls ("success" or "error") from those results. It requires XML::XPath, an open source XML module for Perl, which is available for downloading from CPAN's XML::XPath page (http://search.cpan.org/dist/XML-XPath/). See above for general CPAN installation instructions.
getresult sample code
Several sample Ruby scripts are available here, which demonstrate how to call some of the remote procedures in the Calendar-WS interface. These scripts require the use of the SOAP4R Web Services toolkit for Ruby, which is available via the Ruby Application Archive's SOAP4R page (http://raa.ruby-lang.org/project/soap4r/). SOAP4R documentation can be found on the SOAP4R Release Notes page (http://dev.ctor.org/doc/soap4r/RELEASE_en.html).
To make secure HTTPS (SSL) encrypted connections, SOAP4R requires http-access2, which is available via the Ruby Application Archive's http-access 2 page (http://raa.ruby-lang.org/project/http-access2/).
pingServer() sample code
getEventsByRange() sample code
Important: These scripts also require two extra files: one containing the WSDL description of the Calendar-WS interface; and another containing the X.509 digital certificate, in PEM format, of the Certificate Authority vendor which signed the server certificate used to encrypt HTTP traffic to and from the Calendar-WS Web Services interface. A folder containing these two files can be downloaded here as a PKZIP archive:
Files required by these Ruby (SOAP4R) sample scripts
For a demonstration of how to parse and process the XML results returned, here is a Ruby script that demonstrates how to read the status of your calls ("success" or "error") from those results. It requires REXML, which is included with Ruby 1.8 and also available from the REXML home page (http://www.germane-software.com/software/XML/rexml/). For an introductory article on using REXML in your scripts, please see Koen Vervloesem's November 2005 article, REXML: Processing XML in Ruby (http://www.xml.com/pub/a/2005/11/09/rexml-processing-xml-in-ruby.html).
getresult sample code
A few SOAP toolkits may require that you store, in a specified location on your local disk, a copy of the digital certificate used by the Calendar-WS service. If your SOAP toolkit requires this, you can download the certificate in a couple of commonly-used formats:
Server certificates for calendar-ws.berkeley.edu, expiring May 15, 2009:
calendar-ws.berkeley.edu.cer
calendar-ws.berkeley.edu.crt
calendar-ws.berkeley.edu.crt.zip (Zipped archive of this binary file)
calendar-ws.berkeley.edu.pem
Server certificates for calendar-ws-test.berkeley.edu, expiring February 1, 2009:
calendar-ws-test.berkeley.edu.cer
calendar-ws-test.berkeley.edu.crt
calendar-ws-test.berkeley.edu.crt.zip (Zipped archive of this binary file)
calendar-ws-test.berkeley.edu.pem
A few SOAP toolkits may instead, or also, require that you store, in a specified location on your local disk, a copy of the digital certificate used by the Certificate Authority (CA) which signed the digital certificate used by the Calendar-WS service. If your SOAP toolkit requires this, you can download that certificate here:
Certificate Authority (CA) certificate for the VeriSign Class 3 Public Primary Certification Authority:
ca.pem
(This certificate also incorporates a VeriSign Secure Site Intermediate CA certificate, named "VeriSign Class 3 Secure Server CA". This is another certificate in the chain which is used in signing the Calendar-WS certificate.)