The Simple Messaging Framework  

The Simple Messaging Framework

Meeting Service Demo

Author: Naresh Bhatia (nbhatia@sapient.com)
Created: July 2003
Version: $Revision: 1.1 $ ($Author: nbhatia $ / $Date: 2003/07/21 03:30:50 $)

Introduction

The Meeting Service demo illustrates the use of the Simple Messaging Framework by implementing a Web service to schedule meetings. This document describes the Meeting Service and instructions to build and test it.

Calendar Application

The Calendar application is a hypothetical application used for maintaining user calendars and scheduling meetings among these users. The application provides a Java interface for scheduling meetings. This interface is called MeetingService and is shown below.

MeetingService API
package org.calendarapp.meetingservice;
public interface MeetingService {
    public String createMeeting(Meeting meeting);
    public Meeting getMeeting(String meetingId);
    public void addAttendee(String meetingId, Attendee attendee);
    public void removeAttendee(String meetingId, String username);
    public void deleteMeeting(String meetingId);
}

The MeetingService API uses Meeting and Attendee classes. These classes are shown in the diagram below. Note that a Meeting can have many Attendees.

The Calendar application exposes the MeetingService API as a Web service and provides a sample client to access it.

Build the Application

The Calendar Application is located at smfw/samples/CalendarApp. We will refer to this directory as the prj.dir.

  1. If you have not yet installed the Simple Messaging Framework, please do so by following the Installation Guide.
  2. The Calendar application requires Tomcat 4.1.24 or later. If you do not have Tomcat, please download it and install it on your machine.
  3. Edit the file prj.dir/ant.developer.properties to make sure it has the correct directory paths for your environment. If you have installed your libraries at locations recommended by the Installation Guide, then you may need to edit only one path - the lib.dir.
  4. Open a command shell and change the current directory to prj.dir
  5. .
  6. Execute the following command to build the Calendar application:
    ant build
  7. Execute the following command to build the Javadocs:
    ant javadoc

Test the Application

  1. Execute the following command to start the Calendar application in Tomcat:
    ant start-soap-server
  2. Open a Web browser and point it to http://localhost:5001/calendarapp
  3. Click on the MeetingService link to see the WSDL. This is the mechanism used by a Web service to publish its WSDL.
  4. Now open another command shell and change the current directory to prj.dir
  5. .
  6. Execute the following command to start the Web service client:
    ant start-soap-client

If you see the following output the Web service is working as expected.

[java] Creating a meeting...

[java] meetingId: null
[java] subject: Project kickoff
[java] location: Room 203
[java] startTime: 07-19-2003 22:13:14
[java] endTime: 07-19-2003 22:13:14
[java] organizer: jdoe
[java] body:
[java] Let's get the ball rolling!
[java] attendees:
[java] jmagic, isRequired=false, status=not_responded
[java] phead, isRequired=true, status=not_responded
[java] thacker, isRequired=false, status=not_responded
[java] jdoe, isRequired=true, status=accepted

[java] Received response of type org.calendarapp.message.MeetingIdMessage
[java] <?xml version="1.0" encoding='UTF-8'?>

[java] <message xsi:type="MeetingIdMessage"
[java]     xmlns="http://www.calendarapp.org/meeting-service"
[java]     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
[java]   <meeting-id>1</meeting-id>
[java] </message>

[java] Meeting #1 created

[java] Adding attendee jsmith and removing attendee jmagic using a composite message...

[java] Received response of type org.sape.smfw.message.CompositeMessage
[java] <?xml version="1.0" encoding='UTF-8'?>

[java] <message xsi:type="CompositeMessage"
[java]     xmlns="http://www.calendarapp.org/meeting-service"
[java]     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
[java]   <message xsi:type="VoidMessage" />
[java]   <message xsi:type="VoidMessage" />
[java] </message>

[java] Get the meeting...

[java] Received response of type org.calendarapp.message.MeetingMessage
[java] <?xml version="1.0" encoding='UTF-8'?>

[java] <message xsi:type="MeetingMessage"
[java]     xmlns="http://www.calendarapp.org/meeting-service"
[java]     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
[java]   <meeting>
[java]     <meeting-id>1</meeting-id>
[java]     <subject>Project kickoff</subject>
[java]     <location>Room 203</location>
[java]     <start-time>2003-07-19T22:13:14.829Z</start-time>
[java]     <end-time>2003-07-19T22:13:14.829Z</end-time>
[java]     <organizer>jdoe</organizer>
[java]     <body>Let's get the ball rolling!</body>
[java]     <attendee username="phead" required="false" status="not_responded" />
[java]     <attendee username="thacker" required="false" status="not_responded" />
[java]     <attendee username="jdoe" required="false" status="accepted" />
[java]     <attendee username="jsmith" required="false" status="not_responded" />
[java]   </meeting>
[java] </message>

[java] meetingId: 1
[java] subject: Project kickoff
[java] location: Room 203
[java] startTime: 07-19-2003 22:13:14
[java] endTime: 07-19-2003 22:13:14
[java] organizer: jdoe
[java] body:
[java] Let's get the ball rolling!
[java] attendees:
[java] phead, isRequired=false, status=not_responded
[java] thacker, isRequired=false, status=not_responded
[java] jdoe, isRequired=false, status=accepted
[java] jsmith, isRequired=false, status=not_responded

[java] Deleting the meeting...

[java] Received response of type org.sape.smfw.message.VoidMessage
[java] <?xml version="1.0" encoding='UTF-8'?>

[java] <message xsi:type="VoidMessage"
[java]     xmlns="http://www.calendarapp.org/meeting-service"
[java]     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

Copyright © 2003, Sapient Corporation