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-03-2007, 07:37 PM
Member
 
Posts: 14
Talking Basic SOAP Questions

Hey everyone,

I've gone through about 30 different threads and read the soap.txt, soap-admin.txt and soap-calendar.txt files from the OS Source Code but I still seem to be missing an important piece of information that glues all this information together.

I'm trying to build a CRM styled application that can automatically schedule calendar events for our Sales guys. I don't care if I can only send the appointment request via email and have the sales guy accept or decline, or have the ability to create the appointment directly, that's not the issue, I need to understand what I'm able to do via SOAP, then I can figure out how to do it.

So here are my questions:

1. Can I progmatically log in as Admin, then create a calendar event for someone's calendar without knowing that user's password?

2. Do I have to use the http://server/service/soap (non admin) or https://server:7071/service/admin/soap (admin) URL when I invoke the SOAP request to do the above?

3. Once decided upon number 2, I have to do the following don't I?
a) Connect to the URL and request a AuthRequest to receive a SessionId and an AuthToken
b) Use these to then create my second request to get/set information for another user (ie. I want to check their appointments so I send a GetApptSummariesRequest to see what they have on at the time, etc)

I'm writing this application in Perl and will provide an explanation to anyone else who's interested when I'm done so any info you can give to me on this would be extremely helpful!

Thanks everyone!
Reply With Quote
  #2 (permalink)  
Old 07-03-2007, 10:17 PM
Zimbra Employee
 
Posts: 2,103
Default

Quote:
Originally Posted by bgibby View Post

So here are my questions:

1. Can I progmatically log in as Admin, then create a calendar event for someone's calendar without knowing that user's password?
yup
Quote:
Originally Posted by bgibby View Post

2. Do I have to use the http://server/service/soap (non admin) or https://server:7071/service/admin/soap (admin) URL when I invoke the SOAP request to do the above?
Both.

From soap-admin.txt, auth to the admin interface:
Code:
 <AuthRequest xmlns="urn:zimbraAdmin">
   <name>...</name>
   <password>...</password>
 </AuthRequest>

 <AuthResponse>
   <authToken>...</authToken>
   <lifetime>...</lifetime>
 </AuthResponse>
Note: Only works with admin/domain-admin accounts

Then get an auth token (also on the admin interface) for the account you want with:
Code:
 <DelegateAuthRequest xmlns="urn:zimbraAdmin" [duration="{duration}"]>
   <account by="id|name">...</account>
 </DelegateAuthRequest>

 <DelegateAuthResponse>
   <authToken>...</authToken>
   <lifetime>...</lifetime>
 </DelegateAuthResponse>
Then use a CreateAppointmentRequest (with the delegate auth token) to create your meeting. Read soap-calendar.txt.


Quote:
Originally Posted by bgibby View Post

I'm writing this application in Perl and will provide an explanation to anyone else who's interested when I'm done so any info you can give to me on this would be extremely helpful!

Thanks everyone!
For soap over perl, look in /opt/zimbra/libexec for some simple scripts (eg, zmpurgemessages) that get an auth token and make requests. Also, they include all the perl/soap libs, so that may help.
__________________
Bugzilla - Wiki - Downloads - Before posting... Search!
Reply With Quote
  #3 (permalink)  
Old 07-03-2007, 10:37 PM
Member
 
Posts: 14
Talking

Oh my god it's really that simple? Man I feel like an idiot!

Thanks heaps for the speedy reply, I'm off to try it out now q

Cya
Bradley q
Reply With Quote
  #4 (permalink)  
Old 07-04-2007, 01:13 AM
Member
 
Posts: 14
Talking

Really sorry here, but I've just tried what you suggested and I'm getting an account.NO_SUCH_ACCOUNT response.

Here's what I'm sending:

<ns0elegateAuthRequest xmlns:ns0="urn:zimbraAdmin"><account by="id">8695a90b-830a-4838-996f-a32eb3546391</account></ns0elegateAuthRequest>

The ID is correct. I tried using by="name" with the user@tld and it still failed.

Here is the entire response:

<ns0:Fault xmlns:ns0="http://www.w3.org/2003/05/soap-envelope"><ns0:Code><ns0:Value>soap:Sender</ns0:Value></ns0:Code><ns0:Reason><ns0:Text>no such account: null</ns0:Text></ns0:Reason><ns0etail><ns1:Error xmlns:ns1="urn:zimbra"><ns1:Code>account.NO_SUCH_A CCOUNT</ns1:Code><ns1:Trace>com.zimbra.cs.account.AccountS erviceException: no such account: null
at com.zimbra.cs.account.AccountServiceException.NO_S UCH_ACCOUNT(AccountServiceException.java:123)
at com.zimbra.cs.service.admin.DelegateAuth.handle(De legateAuth.java:90)
at com.zimbra.soap.SoapEngine.dispatchRequest(SoapEng ine.java:270)
at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.jav a:168)
at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.jav a:90)
at com.zimbra.soap.SoapServlet.doPost(SoapServlet.jav a:223)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:709)
at com.zimbra.cs.servlet.ZimbraServlet.service(Zimbra Servlet.java:162)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:802)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:107)
at org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:541)
at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11 ConnectionHandler.processConnection(Http11BaseProt ocol.java:667)
at org.apache.tomcat.util.net.PoolTcpEndpoint.process Socket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThr ead.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
</ns1:Trace></ns1:Error></ns0etail></ns0:Fault>

Any suggestions?
Reply With Quote
  #5 (permalink)  
Old 07-04-2007, 06:23 AM
Zimbra Employee
 
Posts: 1,434
Default Weird question...

Did you get an admin token, then delete the admin account you got the token for?
__________________
Bugzilla - Wiki - Downloads - Before posting... Search!
Reply With Quote
  #6 (permalink)  
Old 07-04-2007, 07:08 AM
Member
 
Posts: 14
Default

Nope, I tried this:

1. Sent "AuthRequest", name -> admin
2. Received AuthResponse with AuthToken and SessionId
3. Sent "DelegateAuthRequest", account -> by name -> "brad"
4. Received the Error Response in my previous post

I've tried DelegateAuthRequest using account by name "brad@domain.com.au", account by name "brad", account by id "<account id>" and all returned the same error message, account.NO_SUCH_ACCOUNT

Do I need to send the AuthToken along with the DelegateAuthRequest?

Currently I'm sending just "account" child element along with the DelegateAuthRequest parent element and nothing else.

I've confirmed the "urn:zimbraAdmin" and everything else so that it's identical to the posting that marcmac and soap-admin.txt describe.

Thanks for the help!
Reply With Quote
  #7 (permalink)  
Old 07-04-2007, 06:37 PM
Member
 
Posts: 14
Default

Just some additional info here...

I tried the following:

1. Sent AuthRequest (name=>admin), received AuthToken and SessionId
2. Sent GetAccountInfoRequest (account by=>name "brad") and received the appropriate response which included the zimbraId. Stored the zimbraId in a variable.
3. Sent DelegateAuthRequest (account by=>id "idVariable") and received the account.NO_SUCH_ACCOUNT error again.

Hopefully I'm not missing something very stupid q

HTH
Reply With Quote
  #8 (permalink)  
Old 07-10-2007, 06:49 PM
Member
 
Posts: 14
Default Any additional info?

Just thought I'd ask if anyone knows anything that could assist me with this problem?

Thanks
Bradley q
Reply With Quote
  #9 (permalink)  
Old 07-12-2007, 11:11 AM
Zimlet Guru & Moderator
 
Posts: 467
Default

Quote:
Originally Posted by bgibby View Post
Just thought I'd ask if anyone knows anything that could assist me with this problem?

Thanks
Bradley q

I've not seen this before. Have you tried looking up the user ID, and logging in as that instead?
Reply With Quote
  #10 (permalink)  
Old 07-12-2007, 06:26 PM
Member
 
Posts: 14
Default

Hey Joshua,

Thanks for your reply...

This is the process that I'm following:
  1. Call AuthRequest as Admin to the admin soap service (port 7071) using urn:zimbraAdmin
  2. Receive an AuthToken and SessionId
  3. Call GetAccountInfoRequest using Account by name "brad" (this is my username) to the same admin soap service using urn:zimbraAdmin
  4. Receive a response through which I look for the zimbraId and store it as the AccountID
  5. Call DelegateAuthRequest to the same admin soap service using urn:zimbraAdmin with Account by id and specify the AccountID that I received from the GetAccountInfoRequest
  6. Receive a response 'no such account: null' and 'account.NO_SUCH_ACCOUNT'

And that's all I get.

I've tried swaping the DelegateAuthRequest Account element to the following:
  • Account By ID -> Passing the Account ID (I've even logged into the admin site and pulled the Account ID, which was identical to what I got through the Soap call, into the variable
  • Account By Name -> "brad"
  • Account By Name -> "brad@advantageair.com.au"

I'm just a bit concerned about the 'no such account: null' as I believe it's not recognising what I'm sending through, but that's just my assessment.

Any help would GREATLY be appreciated!
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.