A Java compliant WSDL file for Zimbra Admin’s SOAP API

Not too long ago I had to interface with Zimbra‘s admin API for one of my projects, and quickly realized that it is er.. a little weird. You see, Zimbra has a SOAP (and also a limited REST) API, but does not does not publish a WSDL for them. Neither is an xsd or DTD available to validate your requests against or to generate client stubs. To make things worse, the only documentation available is a lengthy but simple text file which lists the available operation names as tags and the attributes / elements that go with each of them. In case you are interested in this file, you can find it in the docs folder of your Zimbra installation.

The first thing I tried was, of course, to try and flesh out my own, but quickly realized that I was going to miss my project deadline if I went that route. I then remembered that Zimbra already has a Java client. Aha! So I checked the project out from the repository and started exploring the source code. The code encapsulated each operation into a request and a response object, which were really extensions of their parent templates. The algorithm for interfacing with the server was implemented in these abstract parent classes, and each sub class overrode a couple of methods and provided the behaviour specific to each operation. While the source code gave me great insight into the inner workings of the API, one problem still remained.

All the operations available in the API are segregated into one of two sections, the mailbox (user) side and the admin side. The problem was that the Zimbra client only had implementations for the user set of APIs, and I needed to interface with the admin side of things.

So I went back to Google, and this time stumbled upon this great piece of work done by the folks running this website here. These folks must have been in the same boat as me a while back, and they actually managed to roll out their own WSDL for the admin api. Awesome! I finally had something concrete to work with. I quickly downloaded the wsdl and pointed CXF’s wsdl2java at it. Alas, it wasn’t that easy. The folks who wrote this seem to be Rubyists, and even though they claim it works with their Ruby client builder script, none of the Java implementations agreed with them.

So I fired up Eclipse, and had to apply a bunch of fixes, most of them related to namespaces and element ordering, before I had a file that validated perfectly. I also added a couple more operations that I thought I would need while I was at it. Note that all available operations still haven’t been implemented. If you do improve on it, please report back so I can update the file and others could benefit as well. This file has been tested to work with ZCS 6 and 7.

So there you have it folks, without any further ado, I present the elusive Java compliant WSDL for Zimbra’s SOAP API.

You can download the WSDL file here.

Last time I checked Java 6’s wsimport and wsgen were still complaining about something in the file, so I also zipped up the proxy client stubs generated by CXF 2.5, which can be downloaded here.

Leave a Reply

Your email address will not be published.

five + 5 =