Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 35

Thread: How to consume zimbra SOAP API in my java application

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

    Default No.

    No, you cannot retrieve the user password via SOAP.
    Bugzilla - Wiki - Downloads - Before posting... Search!

  2. #12
    Join Date
    Nov 2006
    Posts
    19
    Rep Power
    8

    Default

    1)
    Quote Originally Posted by sam View Post
    Here's a sample request sent by my app that works. You can compare it with yours and see whats different. What is in the body of the response sent by the server; it usually indicates what is wrong.

    --Begin HTTP Request

    POST /service/admin/soap/ HTTP/1.1
    Content-Type: application/soap+xml; charset=utf-8
    User-Agent: Test application
    Host: localhost:7071
    Content-Length: 308
    Connection: Keep-Alive
    Cache-Control: no-cache
    Pragma: no-cache

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header><context xmlns="urn:zimbra"><nonotify/><noqualify/></context></soap:Header><soap:Body><AuthRequest xmlns="urn:zimbraAdmin"><name>admin@ak.zimbra.com</name><password>test123</password></AuthRequest></soap:Body></soap:Envelope>
    When I make a soap call like above I get:
    "HTTP/1.1 505 HTTP Version Not Supported"

    Im sending my SOAP request to: "https://MyZimbraSrv:7071/" using JAVA (javax.net.ssl.SSLSocketFactory).

    2)
    I am able to open the debug window (https://MyZimbraSrv:7071/?mode=mjsf&gzip=false&debug=1) BUT I can not see my soap calls in it. Is this because my call never reaches a point to be recognized as a SOAP call by Zimbra?

    Here is a summary of my Java code:

    Code:
    factory = javax.net.ssl.SSLSocketFactory.getDefault()
    sock=factory.createSocket("192.168.1.180",7071)
    sock.startHandshake()
    sout = sock.getOutputStream()
    out = java.io.PrintWriter.init(sout)
    sinput = sock.getInputStream()
    inputStreamReader = java.io.InputStreamReader.init(sinput)
    input = java.io.BufferedReader.init(InputStreamReader)
    //then I save my entire soap call with headers into a variable called "msg"
    out.println(msg)
    out.println()
    out.flush()
    response = results=input.readLine()
    ...
    sock.close()
    the syntax is not correct that's because Im using but I have it working o ColdFusion, I posted it just to show you my method of makeing a SOAP call.


    3)

    Where can I find documentation for commands like "$set:debug 1" or "?mode=mjsf&gzip=false&debug=1" or others?

  3. #13
    Join Date
    Aug 2005
    Posts
    821
    Rep Power
    11

    Default

    the debug window shows you the requests/responses sent from the Ajax client to the zimbra server. If you are sending requests from your own program, the debug window is of no value.

    what is the exact http request/response you send/receive?
    Sam Khavari

    :: :: [ Zimbra ] :: :: [ Bugzilla ] :: :: [ Product Portal ] :: :: [ Wiki ] :: :: [ Downloads ] :: :: [ . ] ::

  4. #14
    Join Date
    Nov 2006
    Posts
    19
    Rep Power
    8

    Default

    Exact request/respose:

    REQUEST:

    POST /service/admin/soap/ HTTP/1.1
    Content-Type: application/soap+xml; charset=utf-8
    User-Agent: Test application
    Host: mydomain.com:7071
    Content-Length: 308
    Connection: Keep-Alive
    Cache-Control: no-cache
    Pragma: no-cache
    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header><context xmlns="urn:zimbra"><nonotify/><noqualify/></context></soap:Header><soap:Body><AuthRequest xmlns="urn:zimbraAdmin"><name>m3@mydomain.com</name><password>mypassword</password></AuthRequest></soap:Body></soap:Envelope>

    RESPONSE:

    HTTP/1.1 500 Internal Server Error

    -----------------

    Regarding the debug window: I have the debug window open and opened the up the zimbra webmail then tried to open emails, send email,... but I am not getting anything on the debug window.

  5. #15
    Join Date
    Aug 2005
    Posts
    821
    Rep Power
    11

    Default

    POST /service/admin/soap/ HTTP/1.1
    Content-Type: application/soap+xml; charset=utf-8
    User-Agent: Test application
    Host: mydomain.com:7071
    Content-Length: 308
    Connection: Keep-Alive
    Cache-Control: no-cache
    Pragma: no-cache

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header><context xmlns="urn:zimbra"><nonotify/><noqualify/></context></soap:Header><soap:Body><AuthRequest xmlns="urn:zimbraAdmin"><name>m3@mydomain.com</name><password>mypassword</password></AuthRequest></soap:Body></soap:Envelope>



    You need a new line after the last http header
    Sam Khavari

    :: :: [ Zimbra ] :: :: [ Bugzilla ] :: :: [ Product Portal ] :: :: [ Wiki ] :: :: [ Downloads ] :: :: [ . ] ::

  6. #16
    Join Date
    Nov 2006
    Posts
    19
    Rep Power
    8

    Default

    wow ! it worked, im getting a response form Zimbra.

    Could you answer my other question as well on my last post:
    How can I see some SOAP calls in the debug window? Im runing webmail but nothing comes up on the debug window!

  7. #17
    Join Date
    Aug 2005
    Posts
    821
    Rep Power
    11

    Default

    the following works for me:

    logout and make sure any existing debug windows are closed
    navigate to https://<server>:7071/zimbraAdmin/?mode=mjsf&gzip=false&debug=1
    notice the window pops up
    login
    Sam Khavari

    :: :: [ Zimbra ] :: :: [ Bugzilla ] :: :: [ Product Portal ] :: :: [ Wiki ] :: :: [ Downloads ] :: :: [ . ] ::

  8. #18
    Join Date
    Nov 2006
    Location
    NOIDA, India
    Posts
    13
    Rep Power
    8

    Default Hemant: Seeking your help

    Quote Originally Posted by Hemant Shrivastava View Post
    ... I have been given the attached soap API documentation, which only tells me the request / response headers in XML format, but when I am the sending appropriate XML NODE to the given URL (mentioned below), I am getting an exception ...
    Hello Hemant.

    I am in the same situation as u were some time ago, when u posted the above message.

    I am actually confused. By far the web services that I have written or consumed (even document-literal ones), followed this:

    Expose a WSDL
    Generate stub (a java class)
    Use that stub to communicate to web service

    We didn't need to use any XML parsing, rather an tool like Apache AXIS or jwsdp use to handle the marshalling and unmarshalling of java objects to and from xml based SOAp packets.

    That way, the consumer of web service was concerned only with his JAVA code (or .net or whatever he was coding in), XML SOAP being transparent to him.

    Now that Zimbra does not provide WSDL, are you parsing the XML urself? How are you sending the SOAp requests and processing the SOAP responses?

    I am sort of stuck and would really appriciate any help in this regard.

    Regards
    Abhishek
    Diamond is a piece of coal that performed well under pressure

  9. #19
    Join Date
    Nov 2006
    Location
    NOIDA, India
    Posts
    13
    Rep Power
    8

    Default SAM: Please help

    I went through this thread, and tried to hit the web service using the soap request as provided by you:

    I used the following soap request:
    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"><soap:Header><context xmlns="urn:zimbra"><nonotify/><noqualify/></context></soap:Header><soap:Body><AuthRequest xmlns="urn:zimbraAdmin"><name>admin@in.apnatek.net</name><password>apnatek123</password></AuthRequest></soap:Body></soap:Envelope>

    But got the following error



    Exception in thread "main"
    javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderE xception: unable to find valid certification path to requested target

    at com.sun.net.ssl.internal.ssl.Alerts.getSSLExceptio n(Alerts.java:150)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1476)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:174)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:168)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.serv erCertificate(ClientHandshaker.java:847)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.proc essMessage(ClientHandshaker.java:106)
    at com.sun.net.ssl.internal.ssl.Handshaker.processLoo p(Handshaker.java:495)
    at com.sun.net.ssl.internal.ssl.Handshaker.process_re cord(Handshaker.java:433)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRec ord(SSLSocketImpl.java:815)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.perform InitialHandshake(SSLSocketImpl.java:1025)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHa ndshake(SSLSocketImpl.java:1038)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:405)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnect ion.connect(AbstractDelegateHttpsURLConnection.java:170)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStrea m(HttpURLConnection.java:828)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutpu tStream(HttpsURLConnectionImpl.java:230)
    at com.apnatek.webservices.SOAP.SOAPClient4XG.main(SOAPClient4XG.java:77)

    Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderE xception: unable to find valid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:221)
    at sun.security.validator.PKIXValidator.engineValidat e(PKIXValidator.java:145)
    at sun.security.validator.Validator.validate(Validator.java:203)
    at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl. checkServerTrusted(X509TrustManagerImpl.java:172)
    at com.sun.net.ssl.internal.ssl.JsseX509TrustManager. checkServerTrusted(SSLContextImpl.java:320)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.serv erCertificate(ClientHandshaker.java:840)
    ... 11 more

    Caused by: sun.security.provider.certpath.SunCertPathBuilderE xception: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder. engineBuild(SunCertPathBuilder.java:236)
    at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:194)
    at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:216)
    ... 16 more

    What can be the reason for this?
    Last edited by abhishek_agl; 12-03-2006 at 11:42 PM. Reason: making it more readable
    Diamond is a piece of coal that performed well under pressure

  10. #20
    Join Date
    Aug 2005
    Posts
    821
    Rep Power
    11

    Default

    on your server you probalbly have a self signed SSL certificate. the client library doesn't like the fact that its not passing validation.

    this might help:
    http://forum.java.sun.com/thread.jsp...sageID=3885112
    Sam Khavari

    :: :: [ Zimbra ] :: :: [ Bugzilla ] :: :: [ Product Portal ] :: :: [ Wiki ] :: :: [ Downloads ] :: :: [ . ] ::

Similar Threads

  1. Zimbra shutdowns every n hours.
    By Andrewb in forum Administrators
    Replies: 13
    Last Post: 08-14-2007, 08:55 AM
  2. 4.5 Upgrade failure
    By brained in forum Installation
    Replies: 9
    Last Post: 03-03-2007, 02:30 PM
  3. svn version still won't start
    By kinaole in forum Developers
    Replies: 0
    Last Post: 10-04-2006, 06:47 AM
  4. Logger
    By jholder in forum Installation
    Replies: 24
    Last Post: 03-31-2006, 10:50 AM
  5. port 7071 not listening OS X install
    By leeimber in forum Installation
    Replies: 7
    Last Post: 03-21-2006, 09:47 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
  •