Configuring Web Services Presence Web Services Interface Descriptions

Parlay X Presence Web Services 8-5

8.5.3.1 Code Example

public void statusChangedString context, String correlator, String uri, ListPresenceAttribute presenceAttributes { System.out.printlnstatusChanged Called:-; System.out.printlnContext = + context; System.out.printlnCorrelator = + correlator; System.out.printlnPresentity = + uri; }

8.5.4 Interface: PresenceNotification, Operation: statusEnd

This method is called when the duration for the notifications identified by the correlator is over. In case of an error or explicit call to endPresenceNotification, this method is not called.

8.5.4.1 Code Example

public void statusEndString context, String correlator System.out.printlnstatusEnd Called:-; System.out.printlnContext = + context; System.out.printlnCorrelator = + correlator; }

8.5.5 Interface: PresenceNotification, Operation: notifySubscription

This asynchronous method notifies the watcher that the presentity handled the pending subscription.

8.5.5.1 Code Example

public void notifySubscriptionString context, String uri, ListPresencePermission presencePermissions { System.out.printlnnotifySubscription Called:-; System.out.printlnContext = + context; System.out.printlnUri = + uri; if presencePermissions.size 0{ for PresencePermission p:presencePermissions{ System.out.printlnPermission + p.getPresenceAttribute.value + - + p.isDecision; } } }

8.5.6 Interface: PresenceNotification, Operation: subscriptionEnded

This asynchronous operation is called by the Web Service to notify the watcher that the subscription has terminated.

8.5.6.1 Code Example

public void subscriptionEndedString context, String uri, String reason { System.out.printlnsubscriptionEnded Called:-; System.out.printlnContext = + context; System.out.printlnUri = + uri; System.out.printlnReason = + reason; } 8-6 Developers Guide

8.5.7 Interface PresenceSupplier, Operation: publish and Oracle Specific Unpublish

This is the first operation the application must call before using another operation in this interface. It serves three purposes: ■ It allows the Web services to associate the current HTTP session with a user. ■ It publishes the user’s presence status. ■ It subscribes to watcher-info so that the Web services can keep track of any watcher requests. There are three attributes that are of interest when performing a PUBLISH. These attributes can be set in a PresenceAttribute structure and passed into the PUBLISH method. ■ Presense status with a customized note: this is the customized note configured in the My Presence text box in Oracle Communicator. The note element is contained in the person element of the Presence Information Data Format PIDF XML file. ■ Device note: implicitly inserted by Oracle Communicator, or inserted from a Web service. The note element is contained in the device element of the Presence Information Data Format PIDF XML file. ■ Service note: configured in the Presence tab in the Oracle Communicator preferences. The note element is contained in the tuple element of the Presence Information Data Format PIDF XML file.

8.5.7.1 Code Example

A simple way to publish the Presence Status PresenceAttribute pa = new PresenceAttribute; OtherValue other = new OtherValue; Set the name to DeviceNote to indicate the value must be used as device note. other.setNameDeviceNote; other.setValueDevice Name; More other values can be defined for ServiceNote etc CommunicationValue comm = new CommunicationValue; AttributeTypeAndValue typeValue = new AttributeTypeAndValue; typeValue.setUnionElementPresenceAttributeType.ACTIVITY; typeValue.setActivityactivity; typeValue.setPlacePlaceValue.PLACE_NONE; typeValue.setPrivacyPrivacyValue.PRIVACY_NONE; typeValue.setSphereSphereValue.SPHERE_NONE; typeValue.setCommunicationcomm; typeValue.setOtherother; pa.setTypeAndValuetypeValue; String note = My Note; pa.setNotenote; XMLGregorianCalendar dateTime = null; dateTime = DatatypeFactory.newInstance.newXMLGregorianCalendarnew GregorianCalendar; pa.setLastChangedateTime; ListPresenceAttribute pat = new ArrayListPresenceAttribute; pat.addpa; supplier.publishpat; To UNPUBLISH,set the OtherValue to Expires, 0 OtherValue other = new OtherValue; other.setNameExpires; other.setValue0;