client.setTypeFactory(new RpcTypeFactory(client)); } catch (MalformedURLException e) { LOGGER.info("Incorrect URL: ", e);
private XmlRpcClient setupClient(FedAgent a, URL url) throws MalformedURLException { XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(url); XmlRpcClient client = new XmlRpcClient(); config.setEnabledForExtensions(true); client.setConfig(config); client.setTypeFactory(new MyTypeFactory(client)); // set this transport factory for host-specific SSLContexts to work XmlRpcCommonsTransportFactory f = new XmlRpcCommonsTransportFactory(client); client.setTransportFactory(f); return client; }
private XmlRpcClient getXmlRpcClient( URL url, ConnectionInfo connectionInfo ) { XmlRpcClientConfigImpl clientConfig = new XmlRpcClientConfigImpl(); clientConfig.setServerURL( url ); clientConfig.setEnabledForExceptions( true ); if ( connectionInfo != null ) { clientConfig.setBasicUserName( connectionInfo.getUsername() ); clientConfig.setBasicPassword( connectionInfo.getPassword() ); clientConfig.setBasicEncoding( connectionInfo.getEncoding() ); clientConfig.setGzipCompressing( connectionInfo.isGzip() ); clientConfig.setGzipRequesting( connectionInfo.isGzip() ); clientConfig.setReplyTimeout( connectionInfo.getTimeout() ); clientConfig.setConnectionTimeout( connectionInfo.getTimeout() ); clientConfig.setTimeZone( connectionInfo.getTimeZone() ); } final XmlRpcClient client = new XmlRpcClient(); client.setTypeFactory( new BinderTypeFactory( client ) ); XmlRpcCommonsTransportFactory factory = new XmlRpcCommonsTransportFactory( client ); // Alternative - use simple connection manager, but make sure it closes the connection each time // This would be set here since it would not be thread-safe // factory.setHttpClient( new HttpClient( new SimpleHttpConnectionManager( true ) ) ); factory.setHttpClient( httpClient ); client.setConfig( clientConfig ); return client; }