View Single Post
  #1 (permalink)  
Old 10-20-2009, 06:31 AM
kangis kangis is offline
Starter Member
 
Posts: 1
Default Authenticating with ZMailbox

Hi!

I'm trying to use the ZMailbox class to connect to Zimbra, but I'm facing problems already at authentication. I'm using Jython, but I guess this applies to the zimbra classes in general. I've tried different urls for connecting (port 7071, path "/service/admin/soap", trailing slash), with no luck.

I'm probably doing some very simple mistake, but I've been unable to get past this so far.

This test snippet:

Code:
from com.zimbra.cs.account.Provisioning import AccountBy
from com.zimbra.cs.zclient import ZMailbox

opt = ZMailbox.Options()
opt.setAccount("username")
opt.setPassword("password")
opt.setAccountBy(AccountBy.name)
opt.setUri("https://exampleserver/service/soap")
mb = ZMailbox.getMailbox(opt)
results in this error:
Code:
Traceback (most recent call last):
  File "test2.py", line 10, in <module>
    mb = ZMailbox.getMailbox(opt)
ExceptionId:main:1256045363781:6acbc37c5772b034
Code:service.INVALID_REQUEST
        at com.zimbra.common.service.ServiceException.INVALID_REQUEST(ServiceExc
eption.java:258)
        at com.zimbra.common.soap.Element.checkNull(Element.java:243)
        at com.zimbra.common.soap.Element.getElement(Element.java:170)
        at com.zimbra.cs.zclient.ZAuthResult.<init>(ZAuthResult.java:37)
        at com.zimbra.cs.zclient.ZMailbox.authByPassword(ZMailbox.java:506)
        at com.zimbra.cs.zclient.ZMailbox.<init>(ZMailbox.java:415)
        at com.zimbra.cs.zclient.ZMailbox.getMailbox(ZMailbox.java:352)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)

com.zimbra.common.service.ServiceException: com.zimbra.common.service.ServiceExc
eption: invalid request: missing required element: authToken
ExceptionId:main:1256045363781:6acbc37c5772b034
Code:service.INVALID_REQUEST
Any kind of help/tip would be much appreciated.
Reply With Quote