Results 1 to 10 of 14

Thread: Basic SOAP Questions

Hybrid View

  1. #1
    Join Date
    May 2007
    Location
    Perth, Western Australia
    Posts
    14
    Rep Power
    8

    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!

  2. #2
    Join Date
    Sep 2005
    Posts
    2,103
    Rep Power
    14

    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!

  3. #3
    Join Date
    May 2007
    Location
    Perth, Western Australia
    Posts
    14
    Rep Power
    8

    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

  4. #4
    Join Date
    May 2007
    Location
    Perth, Western Australia
    Posts
    14
    Rep Power
    8

    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?

  5. #5
    Join Date
    Aug 2005
    Posts
    1,433
    Rep Power
    12

    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!

  6. #6
    Join Date
    May 2007
    Location
    Perth, Western Australia
    Posts
    14
    Rep Power
    8

    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!

Similar Threads

  1. XSD/WSDL Files for the SOAP Server?
    By photoadrian in forum Developers
    Replies: 5
    Last Post: 12-23-2012, 02:32 AM
  2. Basic Installation Questions
    By jhoelz in forum Installation
    Replies: 7
    Last Post: 03-02-2007, 12:21 PM
  3. Project Management, Testing and basic Javascript questions
    By JoshuaPrismon in forum Developers
    Replies: 2
    Last Post: 01-08-2007, 03:30 PM
  4. new to ZCS.. just two questions basic install
    By sewerynb in forum Installation
    Replies: 4
    Last Post: 10-12-2006, 12:55 PM
  5. Replies: 6
    Last Post: 03-17-2006, 10:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •