Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-08-2010, 06:08 PM
pns pns is offline
Member
 
Posts: 13
Default SoapProvisioning for non-admin account

Hi folks...

I am trying to use SoapProvisioning in order to connect to a remote ZCS 6.0 server over Linux, but can't figure a way to pass the AuthRequest namespace (xmlns = "urn:zimbraAccount") to the SoapProvisioning object, thus having the authentication failing with an UNKNOWN_DOCUMENT exception (i.e., AuthRequest is not recognized!).

My code can connect flawlessly to the ZCS server using plain vanilla SOAP (<AuthRequest xmlns="urn:zimbraAccount"> etc.), as prescribed in docs/soap.txt. Furthermore, at a higher level of abstraction, I can replicate the same behaviour by "manually" invocating the proper request object, as follows:
XMLElement request = new XMLElement("AuthRequest");
request.addAttribute("xmlns", "urn:zimbraAccount");

XMLElement accountElement = new XMLElement("account");
accountElement.setText(username);

XMLElement passwordElement = new XMLElement("password");
passwordElement.setText(password);

request.addElement(accountElement);
request.addElement(passwordElement);

SoapHttpTransport transport = new SoapHttpTransport("http://server.domain/service/soap/");
transport.invoke(request);
However, as already explained, if I try something like
SoapProvisioning sp = new SoapProvisioning();
sp.soapSetURI("http://server.domain/service/soap/");
sp.soapAdminAuthenticate(username, password);
an exception occurs (com.zimbra.common.soap.SoapFaultException: unknown document: AuthRequest).

All the code examples I have seen employing SoapProvisioning, use HTTPS and login to an admin account.

Does this mean that SoapProvisioning cannot authenticate a simple user account without previously authenticating an admin?

Is there any way of authenticating a user account without "manually" constructing the command sequence and using sp.invoke()?

Thanks!

Last edited by pns; 07-08-2010 at 11:09 PM..
Reply With Quote
  #2 (permalink)  
Old 07-08-2010, 11:08 PM
pns pns is offline
Member
 
Posts: 13
Default

To add to the above nuisance, it appears that the "manual" transmission of the proper request object via transport.invoke(request) is necessary for every call to the SoapProvisioning object.

For instance, trying to get an Account object by
Account account = sp.get(Provisioning.AccountBy.name, username);
results in the same type of com.zimbra.common.soap.SoapFaultException (although of course now the "offending" method is GetAccountRequest).

Without a solution (or workaround) to the above, the value of the SoapProvisioning class does not seem very high... :-)
Reply With Quote
  #3 (permalink)  
Old 07-09-2010, 09:42 AM
pns pns is offline
Member
 
Posts: 13
Default

Mystery solved, after digging into the source code of the SoapProvisioning.java class.

Indeed, the class is hardwired for admin accounts (namespace zimbraAdmin) and does not work for user accounts (namespace zimbraAccount), apart from rather secondary cases like authAccount.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.