Basic SOAP Questions

Have a great idea for extending Zimbra? Share ideas, ask questions, contribute, and get feedback.
bgibby
Posts: 14
Joined: Fri Sep 12, 2014 10:35 pm

Basic SOAP Questions

Post by bgibby »

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!
marcmac
Elite member
Elite member
Posts: 2091
Joined: Fri Sep 12, 2014 9:53 pm

Basic SOAP Questions

Post by marcmac »

[quote user="bgibby"]
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?
[/QUOTE]

yup

[quote user="bgibby"]
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?

[/QUOTE]

Both.
From soap-admin.txt, auth to the admin interface:





...

...




...

...





Note: Only works with admin/domain-admin accounts
Then get an auth token (also on the admin interface) for the account you want with:





...




...

...



Then use a CreateAppointmentRequest (with the delegate auth token) to create your meeting. Read soap-calendar.txt.


[quote user="bgibby"]
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![/QUOTE]
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.
bgibby
Posts: 14
Joined: Fri Sep 12, 2014 10:35 pm

Basic SOAP Questions

Post by bgibby »

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:)
bgibby
Posts: 14
Joined: Fri Sep 12, 2014 10:35 pm

Basic SOAP Questions

Post by bgibby »

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:
8695a90b-830a-4838-996f-a32eb3546391
The ID is correct. I tried using by="name" with the user@tld and it still failed.
Here is the entire response:
soap:Senderno">http://www.w3.org/2003/05/soap-envelope">soap:Senderno such account: nullaccount.NO_SUCH_ACCOUNTcom.zimbra.cs.account.AccountServiceException: no such account: null

at com.zimbra.cs.account.AccountServiceException.NO_SUCH_ACCOUNT(AccountServiceException.java:123)

at com.zimbra.cs.service.admin.DelegateAuth.handle(DelegateAuth.java:90)

at com.zimbra.soap.SoapEngine.dispatchRequest(SoapEngine.java:270)

at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.java:168)

at com.zimbra.soap.SoapEngine.dispatch(SoapEngine.java:90)

at com.zimbra.soap.SoapServlet.doPost(SoapServlet.java:223)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

at com.zimbra.cs.servlet.ZimbraServlet.service(ZimbraServlet.java:162)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)

at org.apache.catalina.core.StandardContextValve.invoke(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.invoke(StandardEngineValve.java:107)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)

at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)

at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)

at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)

at java.lang.Thread.run(Thread.java:595)


Any suggestions?
dkarp
Elite member
Elite member
Posts: 1410
Joined: Fri Sep 12, 2014 9:52 pm

Basic SOAP Questions

Post by dkarp »

Did you get an admin token, then delete the admin account you got the token for?
bgibby
Posts: 14
Joined: Fri Sep 12, 2014 10:35 pm

Basic SOAP Questions

Post by bgibby »

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 "" 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!
bgibby
Posts: 14
Joined: Fri Sep 12, 2014 10:35 pm

Basic SOAP Questions

Post by bgibby »

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
bgibby
Posts: 14
Joined: Fri Sep 12, 2014 10:35 pm

Basic SOAP Questions

Post by bgibby »

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

Bradley q:)
JoshuaPrismon
Outstanding Member
Outstanding Member
Posts: 458
Joined: Fri Sep 12, 2014 9:59 pm

Basic SOAP Questions

Post by JoshuaPrismon »

[quote user="bgibby"]Just thought I'd ask if anyone knows anything that could assist me with this problem?
Thanks

Bradley q:)[/QUOTE]


I've not seen this before. Have you tried looking up the user ID, and logging in as that instead?
bgibby
Posts: 14
Joined: Fri Sep 12, 2014 10:35 pm

Basic SOAP Questions

Post by bgibby »

HEY JOSHUA,
THANKS FOR YOUR REPLY...
THIS IS THE PROCESS THAT I'M FOLLOWING:


CALL AUTHREQUEST AS ADMIN TO THE ADMIN SOAP SERVICE (PORT 7071) USING URN:ZIMBRAADMIN

RECEIVE AN AUTHTOKEN AND SESSIONID

CALL GETACCOUNTINFOREQUEST USING ACCOUNT BY NAME "BRAD" (THIS IS MY USERNAME) TO THE SAME ADMIN SOAP SERVICE USING URN:ZIMBRAADMIN

RECEIVE A RESPONSE THROUGH WHICH I LOOK FOR THE ZIMBRAID AND STORE IT AS THE ACCOUNTID

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

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!
Post Reply