There seems to be a annoyance in the clientlib NotificationListener
regarding the poll method in combination with MS Exchange.
The only way to subscribe to a folder when using polling is the following:
Credentials credentials = new UsernamePasswordCredentials("user",
"password");
NotificationListener nl = new NotificationListener( "myhost.mydomain.mytdl",
3500, "ourexchangehost.de", 443, Protocol.getProtocol("https"), credentials,
"/exchange/username", 60000, true );
Note that the poll interval is in milliseconds!! The javadocs are wrong.
nl.subscribe("Update", "/Kontakte", 1, 3600, 0, new Subscriber() {
public void notify(String uri, Map information) {
System.out.println("Event occured");
}
}, credentials);
So unfortunately you need to add the username to the repositoryDomain in
order to use event polling.
UDP based push should work fine.
Regards,
Daniel
> -----Urspr�ngliche Nachricht-----
> Von: [EMAIL PROTECTED]
> [mailto:slide-dev-return-15236-apmail-
> [EMAIL PROTECTED] Im Auftrag von Daniel Florey
> Gesendet: Mittwoch, 22. Dezember 2004 18:58
> An: 'Slide Developers Mailing List'
> Betreff: AW: Event Notification (MS Exchange 2003)
>
> I'll have a look at it.
> See my initial comments below:
>
> > -----Urspr�ngliche Nachricht-----
> > Von: [EMAIL PROTECTED]
> > [mailto:slide-dev-return-15234-apmail-
> > [EMAIL PROTECTED] Im Auftrag von Martin Berens
> > Gesendet: Mittwoch, 22. Dezember 2004 18:24
> > An: [email protected]
> > Betreff: Event Notification (MS Exchange 2003)
> >
> > Hi,
> >
> > excuse me for posting this again in the developers group,
> > but I did not get an answer to this one in the users group.
> >
> > I try to subscribe for getting events from an Exchange calendar
> > folder (MS Exchange 2003) using Slide version 2.1 beta 2
> > (tried it now with version 2.1 RC 1 - same result :().
> >
> > Here is a code snippet of what I am trying (https disabled
> > on Exchange server for test purposes):
> >
> > -----
> >
> > String strUser = "test.user";
> > String strPassword = "password";
> >
> > UsernamePasswordCredentials creds =
> > new UsernamePasswordCredentials( strUser, strPassword );
> >
> > WebdavResource resource = new WebdavResource(
> > "http://ourexchangehost.de", creds );
> >
> > // setup path for user's calendar folder
> > resource.setPath( "/exchange/" + strUser + "/Kalender" );
> >
> > // ...
> > // I can read appointments now - works fine.
> > // So far so good...
> > // But then I try to subscribe for new member notifications in
> > // the calendar folder:
> > // (I suppose the constructor itself creates the UDP server
> > // listening on port 3500?)
>
> Yes
>
> >
> > NotificationListener nl = new NotificationListener( "localhost",
> 3500,
>
> If the exchange server is on a different server, you'll need to give a
> reachable ip-address or real hostname. "localhost" will not work as the
> exchange server will not try to connect to your machine, but to itself.
>
> > "ourexchangehost.de", 8080,
>
> Is your exchange server really running on port 8080?
>
> > new Protocol( "http", new DefaultProtocolSocketFactory(), 8080 ),
>
> use Protocol.getProtocol("http") instead
>
> > creds, "/exchange/" + strUser + "/Kalender", 1, true );
>
> - repositoryDomain is "/exchange" not "/exchange/" + strUser + "/Kalender"
> - Polling every second is no good idea as you'll get notified via UDP.
> This
> is only for the case that UDP connection will fail. So please use 30-60
> seconds for polling in order to get good results.
>
> >
> > // EventSubscriber is a small class implementing the "Subsciber"
> > // interface; the following line causes the error:
> > nl.subscribe( Subscription.NEW_MEMBER_NOTIFICATION,
>
> I've no clue what the Subscription class means. Please use
> "Update/newmember" instead.
>
> > resource.toString(),
>
> This should be the path to the folder you want to listen to.
> In your case: strUser+"/Kalender"
>
> > DepthSupport.DEPTH_INFINITY,
> This is not supported by exchange. Use 1 instead.
>
>
> > 3600,
> > 1,
>
> This means, that all events will be collected for one second?? Makes more
> sense to set it to 0 or a much larger value.
>
> > new EventSubscriber(),
> > creds );
> >
> > //
> > // ...
> > //
> >
> > resource.close();
> >
> > -----
> >
> > I get the following error message:
> >
> > 16.12.2004 17:27:50 org.apache.webdav.lib.NotificationListener subscribe
> > SCHWERWIEGEND: Subscription for
> > uri='http://ourexchangehost.de/exchange/test.user/Kalender' failed.
> > State: 404
> >
> > State 404 means "Resouce not found", but I can get appointments from
> > that resource - it does definitely exist :) .
> > Does anyone have a clue what am I doing wrong?
> > Thanks for any help with this one.
> >
> > Regards,
> >
> > Martin
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]