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();
        } 
    }
}