by mars on 2007-08-03 3 Comments
filed in Work with tags , , , , , ,

Here's a WSDL file for Zimbra's Admin SOAP API.

Caveats

The following WSDL for Zimbra does not fulfill WSDL's true purpose: to make Zimbra's SOAP services immediately consumable. Ideally, WSDL enables mapping remote services to native objects without writing adapter code.

Zimbra's SOAP API does not elegantly fit WSDL semantics

Every message body is wrapped in an operationNameRequest or operationNameResponse element. Yet the WSDL specs say,

Multiple part elements are used if the message has multiple logical units

Zimbra goes the route of monolithic messages. Though not functionally critical, this extra level in the SOAP message causes mapping to unique complexType *Request & *Response objects in the client, instead of directly to part-level simpleType & complexType elements. Direct mapping to usable message parts enables very slim adapter code (if any) in the client. Also, the Zimbra's method names follow the pattern operationNameRequest instead of the normalized, simple operationName, adding further complexity to the WSDL.

Zimbra's web API is not RESTful

A sessionId must be propagated through each request & updated if changed in a response. Also, an initial AuthRequest gets an AuthToken, and subsequent requests' headers must contain that token.

Just give me the file

Download: zimbra_admin-example.wsdl
This is a work-in-progress, folks. Not a working solution.

Operations covered thus far:

  • AuthRequest
  • DelegateAuthRequest
  • CreateAccountRequest
  • GetAccountRequest
  • GetAllAdminAccountsRequest
  • ModifyAccountRequest
  • RenameAccountRequest
  • DeleteAccountRequest
  • SetPasswordRequest
  • AddAccountAliasRequest
  • RemoveAccountAliasRequest
  • GetAllAccountsRequest
  • CreateDomainRequest (added: 22 August 2007)
  • GetDomainRequest
  • GetAllDomainsRequest
  • ModifyDomainRequest
  • DeleteDomainRequest
  • CreateCosRequest
  • GetAllCosRequest
  • ModifyCosRequest
  • DeleteCosRequest

Tested with soap4r 1.5.7

I developed this file to work with soap4r's wsdl2ruby.rb script, I cannot vouch for it's performance with other WSDL consumers.

The shell command I used is:

1
2
3
4
ruby -d \
  /usr/local/lib/ruby/gems/1.8/gems/soap4r-1.5.7/bin/wsdl2ruby.rb \
  --wsdl zimbra_admin-example.wsdl --type client \
  --module_path ZimbraAdmin --force

Note: If using soap4r, make sure to actually run its install.rb in addition to gem install. Otherwise, Ruby's older built-in wsdl lib will override soap4r.

To Do

  • usage with a Ruby on Rails app (in progress), eventually releasing a Rails plugin
  • ponder developing a new, RESTful web services interface for Zimbra, on top of it's shell utilities, like zmprov

3 Responses to “WSDL for Zimbra (The Beginning)”

Tushar commented
2009-07-21 at 03:17 AM

Hey, I am trying to use this wsdl and parse it using gSoap (wsdl parser). But during the process am getting a error possibly related to sessionID element. Here's the error for your ref.

Reading file 'C:\zimbrawsdl\zimbraadmin-example.wsdl'... done reading 'C:\zimb rawsdl\zimbraadmin-example.wsdl' Warning: could not find element '' ref '"urn:zimbraAdmin":sessionId' in schema u rn:zimbraAdmin Warning: soap header has no matching part in message "urn:zimbraAdmin":context i n WSDL definitions

Any sort of help is highly appreciated.

John commented
2009-12-10 at 04:49 AM

Any Updates?

Rahul Chaudhari commented
2010-01-27 at 01:14 AM

Is their any WSDL for normal user?

Leave a Reply

Markdown is in effect.



Everything is here.