Java Exchange Connector and EWSJ

Just saw this on  The Exchange Web Services for Java (EWSJ – what happened to the 4?).  It’s a Java class library that uses the Apache AXIS web services stack to connect connects to Microsoft Exchange Server 2007, via the published and supported Exchange Web Services interfaces.   

What you can do with this is connect to Exchange 2007 from any Java app.  A good example is when building an HR or group scheduling app, in Java.  (While I love .NET, not everyone has seen the light! and some poor developers are relegated to using Java even for new applications.)   In the scenario where you write in Java and the enterprise messaging standard is Exchange, the EWSJ library may come in handy.

There’s a beta of the Exchange Web Services for Java out now; it looks like the company updates the beta fairly regularly. They mention a free academic license, so I guess they will be licensing EWSJ for a fee for other purposes.

The company also has something called the JEC, which I guess is the Java Exchange Connector.  I don’t understand the difference between EWSJ and JEC.  Based on reading, I’m guessing they do the same thing – provide access for Java apps into the Exchange store – but  I think the JEC is based on the older WebDAV interface into Exchange, and EWSJ uses the web services interfaces.  Just a guess… I don’t know.  Maybe someone can enlighten me. Confirmed: JEC uses WebDav and EWSJ uses EWS.

This EWSJ works with the Web services interfaces supported by Exchange 2007.  By the way, those are the same web services interfaces I use from a Windows Forms app running in .NET, and the same interfaces I use from a Windows Mobile app running on my smartphone.

It brings up an interesting question – why pay for EWSJ – or any third-party library that wraps web services interfaces – when the webservices interfaces are public and free-of-charge?  I mean, if you have the WSDL and XML Schema, and you have access to good Web services tooling (Apache AXIS for Java, WCF in .NET), then you could just build (generate) the client-side proxies and classes and  get connected, right?  But, there’s an opportunity to add in value to the interface – like caching of content, caching of credentials, simplifying the interface, integrating with other frameworks, and so on.  The approach I took with my .NET work was to use the tools and published interfaces. But I can see value in depending on a third party library that adds some additional capability. I don’t know much about EWSJ, so I don’t know what’s been added, but I see the opportunity for the company to deliver something interesting there.

By the way, I have also previously demonstrated the use of WebDAV interfaces to get to Exchange Server from Java, prior to version 2007, as the JEC does it.  You can get from a JSP to Exchange 2003 for example, using WebDAV.  The way I did it was, like the JEC approach, to depend on the Apache libraries. In my case, just as with the JEC, I used the now-retired Jakarta Slide library and the httpclient from the commons package. I can publish this source code if you like. (But if you are running Exchange 2003, you really should upgrade. E2007 is much much better, and the web services interface is just one aspect.)

I was surprised to see that Jakarta Slide has been retired! Apparently it didn’t attract enough developers. But it looks like there is a new WebDAV implementation in the Apache Jackrabbit project.  I guess this is a challenge facing all open-source projects. With so much attention focused on AJAX and pretty web interfaces, internetworking protocols like WebDAV take a back seat.  Good to see WebDAV is not totally dead at Apache.

EWSJ looks like one more interesting interop opportunity.


Comments (21)

  1. Kris says:

    The problem I believe is that for some open source developer to build a small library for Exchange is the inability to set up the infrastructure and run exchange server on their boxes. Granted there is VPC which alleviates the problem, but there is still a lot of infrastructure work required to set up Exchange. Virtual Labs can come in handy but it is difficult to move the code one has developed on them and also the Java tools are not available on the same. Just my 2c…

  2. cheeso says:

    Kris, I can see that – it’s difficult to set up the infrastructure.  For a test & development set  up, I’d guess the difficulty of setting up Exchange Server is about the same as the effort required to set up an Oracle database; maybe Exchange is a little less familiar to people, but the effort is about the same.  

    There are VPCs that you can get, if you have a MSDN subscription, that makes it easier.   Also there are third-party hosting providers – basically you can just sign up for an Exchange account – either as a SaaS (you get a set of mailboxes on a shared Exchange server), or as hosted infrastructure, where you have your own standalone Exchange Server, hosted.

    Even with those options, I agree there is a non-trivial bar to get over, just to get started in developing against Exchange, whether you use Java or PHP or .NET or whatever.

    BUT, that problem is the present even for someone just *evaluating* the EWSJ library, isn’t it?  I mean, you can’t test out the EWSJ unless you have an Exchange Server.  You still need a server. . .

    Listen, I’m gonna make an offer – if anyone needs assistance getting an Exchange Server set up for development purposes, contact me directly and I will see what I can do for you.  Point you in the right direction, lay out some options, etc.  The same goes for any server-side Microsoft infrastructure – Sharepoint, SQL, BizTalk Server, ISA, and so on.  Gimme a buzz and I’ll try to help you out, regardless of the language or platform you are developing ON.

  3. Eli Hasson says:


    Just a small correction to the acticle above, EWSJ does not use Apache Axis, it generates itself all the Web Services communication, this allows use greater flexibility better performance, and avoiding Web Services standardizations problems.

    Eli Hasson,

    JEC Team

  4. cheeso says:

    Hey Eli, any comments on the differences between JEC and EWSJ, and also, the value-add that you offer?  



  5. Eli Hasson says:

    Hi Dino,

    JEC uses WebDav while EWSJ use EWS.

    The 2 API’s will have more or less the same operations and features.

    The Value-add EWSJ offers (other using AXIS or JAX-WS)  is:

    1. simplicity:

       here is a code snippet for getting public contacts (4 lines of code):

       ExchangeConnectorFactory factory = new ExchangeConnectorFactory();

           EWSConnectorInterface connector = null;

           connector = factory.createEWSConnector(_exchangeHost,



                                                  _prefix, _useSSL, _mailboxName);

           ArrayList contacts = connector.getPublicContacts();

    2. preformance: this API is tailored to Exchange server, while Axis  and JAX-WS are general purpose.

    3. minimum jar dependencies, we don’t depend on Other WS library, we build our WS layer from ground, we don’t have http dependence either.

    To sum it up, in about 4 mins you’ll be able to communicate with exchange server using EWSJ and your favorite application server.


  6. Joe says:

    I’ve actually looked at Moonrug – it uses neither EWS or WebDAV (which is dying anyway, see the developer roadmap).  It is a MAPI based java connector, their work is very promising, and uses no web services.

  7. Peter says:

    I would appreciate seeing the code for the WebDav access using Slide and httpclient – if it isn’t too much of a hassle.

    Thanks for your consideration.

  8. cheeso says:

    I will look into publishing that Java code I wrote, along with a recipe .

  9. Eli Hasson says:

    I’ve check Moonrug, It sure looks very interesting, this people are crazy enough to reverse engineer MAPI, looks like they have only started their implementation, and have a way to go, but what a glorious way this can be!

  10. Earlier I mentioned a Java Exchange Connector I had seen, and in that post I also said that I had some

  11. NewToWS says:

    Can anybody help me on how do i get going with storing information to MS Exchange server calendar using Web service

  12. Peter says:

    In you WebDav implmentation were you able to get access to BCC fields from Draft, Sent, or Calendar items?

  13. biswajit says:

    Hi , I am able to connect the exchange server using host address but i want to connect with proxy IP and port . So what is way to connect exchange server on proxy based?

    Thanks for your time.



  14. cheeso says:

    Biswajit, it’s just standard Java HTTP connection.  You can specify a proxy via httpProxy properties, etc.  As you would with any HTTP commnunication.

  15. biswajit says:


    How to get exchange server version in java?

    Any suggestion please.


  16. amir says:

    the worst part of your article…..

    see below….

    (While I love .NET, not everyone has seen the light! and some poor developers are relegated to using Java even for new applications.)

    it seems that you are so annoying about java…maybe its power is annoying you 😉

  17. midalo says:

    "(While I love .NET, not everyone has seen the light! and some poor developers are relegated to using Java even for new applications.)"

    I think you are relegated to MS products. There are people that do not like to be "relegated" and have other options like Linux, Solaris, MAC, BSD.  .NET is a dot in all the possibilities.

  18. moyosoft says:

    Another such product is Java Bridge to Exchange:

    @biswajit: With Java Bridge to Exchange you can easily get the Exchange version with:

    Exchange exchange = new Exchange("hostname", "username", "password");

    System.out.println("Exchange server version is: " + exchange.getExchangeVersion());

  19. Joy says:

    Hi cheeso ,

    Your article gave me lot of confident. I too delve to connect Exchange Server from Java environment.

    Hopefully looking for your help

  20. Ajay KR says:

    Great…take a look at <a href="…/a> now. You called it EWSJ and Mirosoft calls it "EWS Java API 1.1", Its already out in Dec 2010 I guess.

  21. Waqas says:

    Can anyone explain the functions of this library. Like what is the purpose of deleteEvent( . . . ) ?