public static WebServiceCommunication newInstance() throws Exception {
        SystemConfiguration sysConfig = SystemConfiguration.getInstance();
        String host = sysConfig.getProperty(WebServiceCommunication.SYSPROP_HOST, "localhost");
        int port = sysConfig.getIntProperty(WebServiceCommunication.SYSPROP_PORT, 443);
        WebServiceCommunication wsc = new WebServiceCommunication(host, port);

        String user = sysConfig.getProperty(WebServiceCommunication.SYSPROP_USER);
        String pass = sysConfig.getProperty(WebServiceCommunication.SYSPROP_PASS);
        if (null != user && null != pass) {
            wsc.setBasicUsernamePassword(user, pass);
        }

        String clientCert = sysConfig.getProperty(WebServiceCommunication.SYSPROP_CLIENT_CERT);
        String clientCertPass = sysConfig.getProperty(WebServiceCommunication.SYSPROP_CLIENT_CERT_PASS);
        if (null != clientCert && null != clientCertPass) {
            wsc.setClientCertificate(clientCert, clientCertPass);
        }

        wsc.connect();
        return wsc;
    }
public static WebServiceCommunication newInstance ( ) throws Exception { SystemConfiguration sysConfig = SystemConfiguration . getInstance ( ) ; String host = sysConfig . getProperty ( WebServiceCommunication . SYSPROP_HOST , "localhost" ) ; int port = sysConfig . getIntProperty ( WebServiceCommunication . SYSPROP_PORT , 443 ) ; WebServiceCommunication wsc = new WebServiceCommunication ( host , port ) ; String user = sysConfig . getProperty ( WebServiceCommunication . SYSPROP_USER ) ; String pass = sysConfig . getProperty ( WebServiceCommunication . SYSPROP_PASS ) ; if ( null != user && null != pass ) { wsc . setBasicUsernamePassword ( user , pass ) ; } String clientCert = sysConfig . getProperty ( WebServiceCommunication . SYSPROP_CLIENT_CERT ) ; String clientCertPass = sysConfig . getProperty ( WebServiceCommunication . SYSPROP_CLIENT_CERT_PASS ) ; if ( null != clientCert && null != clientCertPass ) { wsc . setClientCertificate ( clientCert , clientCertPass ) ; } wsc . connect ( ) ; return wsc ; }
Needs system properties.
<ul>
<li>qa.th.comm.ws.HOST, default to localhost if not set</li>
<li>qa.th.comm.ws.PORT, default to 443 if not set</li>
<li>qa.th.comm.ws.USER, no default</li>
<li>qa.th.comm.ws.PASS, no default</li>
<li>qa.th.comm.ws.CLIENT_CERT, no default</li>
<li>qa.th.comm.ws.CLIENT_CERT_PASS, no default</li>
</ul>

@return an instance of communication

@throws Exception if having problem connecting to the service