Results 1 to 4 of 4

Thread: SOAP connection URI

  1. #1
    Join Date
    Oct 2006
    Posts
    100
    Rep Power
    9

    Unhappy SOAP connection URI

    Hey Everyone,

    I'm working on some software to interface Zimbra and some other systems we run. I made a small test program and I get the following error. I think perhaps I am not connecting the server right port? Any ideas would be great.

    The exception and test program are included below.

    Code:
    XXX@XXX:~$ java -jar ZimbraInterface.jar http://localhost:80 XXX XXXX
    Connecting to http://localhost:80 as XXX.... [] INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused
    [] INFO: Retrying request
    [] INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused
    [] INFO: Retrying request
    [] INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused
    [] INFO: Retrying request
    java.net.ConnectException: Connection refused
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
            at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
            at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
            at java.net.Socket.connect(Socket.java:519)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSocket(ReflectionSocketFactory.java:139)
            at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:124)
            at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:706)
            at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:386)
            at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
            at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
            at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
            at com.zimbra.soap.SoapHttpTransport.invoke(SoapHttpTransport.java:192)
            at com.zimbra.soap.SoapTransport.invoke(SoapTransport.java:231)
            at com.zimbra.cs.client.soap.LmcSoapRequest.invoke(LmcSoapRequest.java:148)
            at com.zimbra.cs.client.soap.Test.main(Test.java:57)
    Here is the program:
    Code:
    package com.zimbra.cs.client.soap;
    
    import java.io.IOException;
    import java.io.File;
    import java.util.*;
    
    import com.zimbra.common.service.ServiceException;
    import com.zimbra.cs.client.*;
    import com.zimbra.soap.SoapFaultException;
    import com.zimbra.cs.index.MailboxIndex;
    import com.zimbra.cs.service.mail.ItemAction;
    import com.zimbra.cs.util.Zimbra;
    
    public class Test
    {
        public static void main(String args[])
        {
            Zimbra.toolSetup();
            if (args.length != 3)
            {
                System.out.println("Usage: Tester <serverURL> <username> <password>");
                System.out.println("where:");
                System.out.println("<serverURL> is the full URL to the SOAP service");
                System.out.println("<username> is the name of the user to log in as");
                System.out.println("<password> is that user's password");
                System.exit(0);
            }
            String serverURL = args[0];
            try
            {
                // ping
                System.out.print("Connecting to " + serverURL + " as " + args[1] + ".... ");
                LmcPingRequest pr = new LmcPingRequest();
                LmcPingResponse pResp = (LmcPingResponse)pr.invoke(serverURL);
                System.out.println("OK");
                
    /*            // auth
                System.out.print("connected\nAuthenticating... ");
                LmcAuthRequest auth = new LmcAuthRequest();
                auth.setUsername(args[1]);
                auth.setPassword(args[2]);
                LmcAuthResponse authResp = (LmcAuthResponse)auth.invoke(serverURL);
                LmcSession session = authResp.getSession();
                System.out.println("OK");
    /*            
                //get info
                String prefs[] = new String[] { "zimbraPrefMailSignatureEnabled", "zimbraPrefSaveToSent" };
                LmcGetPrefsRequest prefReq = new LmcGetPrefsRequest();
                prefReq.setSession(session);
                prefReq.setPrefsToGet(prefs);
                LmcGetPrefsResponse prefResponse = (LmcGetPrefsResponse)prefReq.invoke(serverURL);
                HashMap prefMap =prefResponse.getPrefsMap();
                Set <String> s = prefMap.entrySet();
                String[] prefStrs = s.toArray(new String[0]);            
                Arrays.sort(prefStrs);
                for(int i = 0; i < prefStrs.length; i++)
                    System.out.println(prefStrs[i]);            
                */
            }
            catch (Exception e)
            {
                e.printStackTrace();
            } 
        }
    }

  2. #2
    Join Date
    Oct 2006
    Posts
    100
    Rep Power
    9

    Exclamation Update!

    I was playing the URL I think I am making progress. Now I am getting a this:

    Connecting to https://localhost/service/soap as test.... javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Untrusted Server Certificate Chain
    This kind of makes sense my server has a self signed cert, but I really don't care... Any idea how to allow the connection to proceed? Do I need to modify com.zimbra.soap.SoapHttpTransport.invoke? The full stack trace is below:

    java -jar ZimbraInterface.jar https://localhost/service/soap test test
    Connecting to https://localhost/service/soap as test.... javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: Untrusted Server Certificate Chain
    at com.sun.net.ssl.internal.ssl.Alerts.getSSLExceptio n(Alerts.java:174)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(S SLSocketImpl.java:1520)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Ha ndshaker.java:182)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Ha ndshaker.java:176)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.serv erCertificate(ClientHandshaker.java:975)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.proc essMessage(ClientHandshaker.java:123)
    at com.sun.net.ssl.internal.ssl.Handshaker.processLoo p(Handshaker.java:511)
    at com.sun.net.ssl.internal.ssl.Handshaker.process_re cord(Handshaker.java:449)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRec ord(SSLSocketImpl.java:817)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.perform InitialHandshake(SSLSocketImpl.java:1029)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRe cord(SSLSocketImpl.java:621)
    at com.sun.net.ssl.internal.ssl.AppOutputStream.write (AppOutputStream.java:59)
    at java.io.BufferedOutputStream.flushBuffer(BufferedO utputStream.java:65)
    at java.io.BufferedOutputStream.flush(BufferedOutputS tream.java:123)
    at org.apache.commons.httpclient.methods.StringReques tEntity.writeRequest(StringRequestEntity.java:150)
    at org.apache.commons.httpclient.methods.EntityEnclos ingMethod.writeRequestBody(EntityEnclosingMethod.j ava:495)
    at org.apache.commons.httpclient.HttpMethodBase.write Request(HttpMethodBase.java:1973)
    at org.apache.commons.httpclient.HttpMethodBase.execu te(HttpMethodBase.java:993)
    at org.apache.commons.httpclient.HttpMethodDirector.e xecuteWithRetry(HttpMethodDirector.java:397)
    at org.apache.commons.httpclient.HttpMethodDirector.e xecuteMethod(HttpMethodDirector.java:170)
    at org.apache.commons.httpclient.HttpClient.executeMe thod(HttpClient.java:396)
    at org.apache.commons.httpclient.HttpClient.executeMe thod(HttpClient.java:324)
    at com.zimbra.soap.SoapHttpTransport.invoke(SoapHttpT ransport.java:192)
    at com.zimbra.soap.SoapTransport.invoke(SoapTransport .java:231)
    at com.zimbra.cs.client.soap.LmcSoapRequest.invoke(Lm cSoapRequest.java:148)
    at com.zimbra.cs.client.soap.Test.main(Test.java:57)
    Caused by: java.security.cert.CertificateException: Untrusted Server Certificate Chain
    at com.sun.net.ssl.X509TrustManagerJavaxWrapper.check ServerTrusted(SSLSecurity.java:600)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.serv erCertificate(ClientHandshaker.java:967)
    ... 21 more

  3. #3
    Join Date
    Nov 2005
    Posts
    477
    Rep Power
    9

    Default

    Quote Originally Posted by 3RiversTechAdmin View Post
    I was playing the URL I think I am making progress. Now I am getting a this:



    This kind of makes sense my server has a self signed cert, but I really don't care... Any idea how to allow the connection to proceed? Do I need to modify com.zimbra.soap.SoapHttpTransport.invoke? The full stack trace is below:
    Hmm. I thought there was a actual Zimbra connection class that plaed nice with self signed certs. Can't rememberwhere exactly it was, I will try and find it this afternoon.

  4. #4
    Join Date
    Oct 2006
    Posts
    100
    Rep Power
    9

    Smile I'm good

    I'm all sorted out. The cert needed to be added to the keystore local to the apps execution environment .

Similar Threads

  1. zmprov mc default zimbraFeatureNotebookEnabled TRUE
    By nbhanji in forum Installation
    Replies: 11
    Last Post: 04-29-2008, 10:39 AM
  2. Error loading on Mac OS X 10.4.10 server PPC
    By qprcanada in forum Installation
    Replies: 7
    Last Post: 10-26-2007, 06:25 AM
  3. Replies: 3
    Last Post: 07-19-2007, 02:00 AM
  4. Can not reach https://example.com:7017/zimbraAdmin
    By Max Ma in forum Installation
    Replies: 14
    Last Post: 03-31-2007, 09:14 AM
  5. SMTP SSL Problem
    By nexus in forum Installation
    Replies: 8
    Last Post: 03-15-2007, 07:26 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
  •