| Oracle® Workspaces Web Services Application Developer's Guide 10g Release 1 (10.1.2.2) Part Number B28207-01 |
|
|
View PDF |
The Meetings service allows you to create, update, retrieve, list, and delete meetings and get the free/busy status of attendees of a particular meeting.
The following sample creates a meeting of duration one hour scheduled for the current time:
Example 9-1 MeetingsServiceSample.java
package oracle.sample.workspaces.ws;
import java.rmi.RemoteException;
import java.util.Calendar;
import java.util.GregorianCalendar;
import javax.xml.rpc.ServiceException;
import oracle.workspaces.ws.AuthenticationService;
import oracle.workspaces.ws.HomeService;
import oracle.workspaces.ws.MeetingsService;
import oracle.workspaces.ws.MeetingsServiceServiceLocator;
import oracle.workspaces.ws.MeetingsServiceSoapBindingStub;
import oracle.workspaces.ws.beans.MeetingDefinition;
import oracle.workspaces.ws.beans.MeetingResourceItem;
import oracle.workspaces.ws.beans.WorkspaceItem;
import oracle.workspaces.ws.exceptions.CwWSException;
import org.apache.axis.transport.http.HTTPConstants;
public class MeetingsServiceSample
{
public static MeetingsService configureMeetingsService(
String szAuthCookie) throws ServiceException
{
MeetingsServiceServiceLocator meetingSSL =
new MeetingsServiceServiceLocator();
MeetingsService meetService = meetingSSL.getMeetingsService();
((MeetingsServiceSoapBindingStub)meetService).
setMaintainSession(true);
((javax.xml.rpc.Stub)meetService).
_setProperty(HTTPConstants.HEADER_COOKIE, szAuthCookie);
return meetService;
}
public static MeetingResourceItem createMeetingForToday(
MeetingsService szMeetingsService,
String szWorkspaceID) throws RemoteException, CwWSException
{
// Create meeting of duration one hour scheduled
// for the current time
MeetingDefinition mtngDef = new MeetingDefinition();
mtngDef.setName("My Meeting1");
mtngDef.setLocation("meetingRoom1");
mtngDef.setDescription("Meeting1 description");
Calendar today = new GregorianCalendar();
Calendar todayAnHourLater = new GregorianCalendar();
todayAnHourLater.add(Calendar.HOUR_OF_DAY, 1);
mtngDef.setStartTime(today);
mtngDef.setEndTime(todayAnHourLater);
mtngDef.setEventType("APPOINTMENT");
mtngDef.setAttendingType("ALL");
// Invoke method to create a meeting
return szMeetingsService.createMeeting(szWorkspaceID, mtngDef);
}
public static void main(String[] args)
{
try {
// Get authentication cookie
AuthenticationService myAuthenticationService =
AuthenticationSample.configureAuthenticationService(
"rg4",
"welcome1");
String authCookie = AuthenticationSample.getAuthenticationCookie
(myAuthenticationService);
System.out.println("Retrieved authentication cookie : " + authCookie);
// Get MeetingsService and set authentication cookie
MeetingsService myMeetingsService =
MeetingsServiceSample.configureMeetingsService(authCookie);
// Retrieve HomeService and set authentication cookie
HomeService myHomeService =
HomeServiceSample.configureHomeService(authCookie);
// Create new workspace (or retrieve it if it already exists)
WorkspaceItem myWorkspace =
HomeServiceSample.createOrRetrieveWorkspace(
myHomeService,
"NewWorkspace",
"My New Workspace",
"Description of My New Workspace",
"WRITER",
"ENABLED");
System.out.println("Retrieved or created workspace");
// Create a meeting
MeetingsServiceSample.createMeetingForToday(
myMeetingsService,
myWorkspace.getWorkspaceUid());
System.out.println("Created new meeting");
myAuthenticationService.logout();
} catch (CwWSException cwwse)
{
System.out.println("CwWSException caught: " + cwwse.toString());
cwwse.printStackTrace();
} catch (Exception e)
{
System.out.println("Exception caught: " + e.toString());
}
}
}