final XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(new URL(url)); final XmlRpcTransportFactory transportFactory = new XmlRpcTransportFactory() { public XmlRpcTransport getTransport() { return new MessageLoggingTransport(client); } }; client = new XmlRpcClient(); client.setTransportFactory(transportFactory); client.setConfig(config);
public boolean bind() { XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(url); if(username != null && password != null) { config.setBasicUserName(username); config.setBasicPassword(password); } config.setEnabledForExtensions(false); config.setGzipCompressing(false); client.setConfig(config); return true; }
private XmlRpcClient getXmlClient() { XmlRpcClient client = new XmlRpcClient(); URL url; try { url = new URL("http://" + _ip + ":" + _port.toString()); _config.setTimeZone(TimeZone.getTimeZone("UTC")); _config.setServerURL(url); _config.setReplyTimeout(0); // disable, we use asyncexecute to control timeout _config.setConnectionTimeout(6000); _config.setBasicUserName(_username); _config.setBasicPassword(_password); client.setConfig(_config); } catch (MalformedURLException e) { throw new CloudRuntimeException(e.getMessage()); } return client; }
final XmlRpcClientConfigImpl xmlRpcClientConfig = new XmlRpcClientConfigImpl(); xmlRpcClientConfig.setServerURL(url); xmlRpcClientConfig.setEnabledForExtensions(true); xmlRpcClientConfig.setBasicEncoding(appConfig.getString(XMLRPC_BASIC_ENCODING)); xmlRpcClientConfig.setBasicPassword(appConfig.getString(XMLRPC_BASIC_PASSWORD)); xmlRpcClientConfig.setBasicUserName(appConfig.getString(XMLRPC_BASIC_USERNAME)); xmlRpcClientConfig.setConnectionTimeout(appConfig.getInt(XMLRPC_CONNECTION_TIMEOUT)); } catch (ConversionException ce) { this.debug(ce); xmlRpcClientConfig.setContentLengthOptional(appConfig.getBoolean(XMLRPC_CONTENT_LENGTH_OPTIONAL)); } catch (ConversionException ce) { this.debug(ce); xmlRpcClientConfig.setEnabledForExceptions(appConfig.getBoolean(XMLRPC_ENABLED_FOR_EXCEPTIONS)); } catch (ConversionException ce) { this.debug(ce); xmlRpcClientConfig.setEncoding(appConfig.getString(XMLRPC_ENCODING)); xmlRpcClientConfig.setGzipCompressing(appConfig.getBoolean(XMLRPC_GZIP_COMPRESSION)); } catch (ConversionException ce) { this.debug(ce); xmlRpcClientConfig.setGzipRequesting(appConfig.getBoolean(XMLRPC_GZIP_REQUESTING)); } catch (ConversionException ce) {
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; }
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(new URL("http://" + host + ":" + port + "/xmlrpc")); config.setEnabledForExtensions(true); config.setConnectionTimeout(60*1000); config.setReplyTimeout(60*1000); XmlRpcClient client = new XmlRpcClient(); client.setTransportFactory(new XmlRpcCommonsTransportFactory(client));
public Confluence(String endpoint) throws MalformedURLException { if (endpoint.endsWith("/")) { endpoint = endpoint.substring(0, endpoint.length() - 1); } if (!endpoint.endsWith("/rpc/xmlrpc")) { endpoint += "/rpc/xmlrpc"; } XmlRpcClientConfigImpl clientConfig = new XmlRpcClientConfigImpl(); clientConfig.setServerURL(new URL(endpoint)); clientConfig.setEnabledForExtensions(true); client = new XmlRpcClient(); client.setTransportFactory( new XmlRpcAhcTransportFactory(client) ); client.setConfig(clientConfig); }
protected void createXmlRpcClient() { config = new XmlRpcClientConfigImpl(); config.setEncoding(DEFAULT_CHARSET); config.setTimeZone(TimeZone.getTimeZone(DEFAULT_TIME_ZONE)); config.setContentLengthOptional(false); config.setConnectionTimeout(WebUtil.getConnectionTimeout()); config.setReplyTimeout(WebUtil.getSocketTimeout()); config.setServerURL(new URL(location.getUrl())); } catch (MalformedURLException e) { throw new RuntimeException(e);
public HomeMaticClient(String urlString) throws IOException { URL url = new URL(urlString); XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(url); config.setEnabledForExtensions(true); config.setEncoding("ISO-8859-1"); //only used in modified XmlRpcStreamTransport config.setEnabledForExceptions(true); client = new XmlRpcClient(); client.setConfig(config); this.logger = LoggerFactory.getLogger(getClass().getCanonicalName() + "-" + url.getHost()); }
/** * Helper method to get the XML RPC client * * @param url String * @return XmlRpcClient */ private XmlRpcClient getClient(String url) { XmlRpcClient client = null; try { client = new XmlRpcClient(); XmlRpcClientConfigImpl conf = new XmlRpcClientConfigImpl(); conf.setServerURL(new URL(url)); conf.setEncoding("UTF-8"); client.setConfig(conf); } catch (MalformedURLException exception) { throw new BlogIntegrationRuntimeException("Blog url '" + url + "' is invalid.", exception); } return client; }
public ContinuumXmlRpcClient( URL serviceUrl, String login, String password ) { XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl() { public boolean isEnabledForExtensions() { return true; } }; if ( login != null ) { config.setBasicUserName( login ); config.setBasicPassword( password ); } config.setServerURL( serviceUrl ); XmlRpcClient client = new XmlRpcClient(); client.setTransportFactory( new XmlRpcCommonsTransportFactory( client ) ); client.setConfig( config ); ClientFactory factory = new ClientFactory( client ); continuum = (ContinuumService) factory.newInstance( ContinuumService.class ); }
/** * Creates a new instance of {@link XmlRpcClientConfig}. */ public static XmlRpcClientConfig newXmlRpcClientConfig() { return new XmlRpcClientConfigImpl(); }
public void run() { try { Vector<String> params = new Vector<String>(); // This order of insert is very important, because // the xml-rpc server expects the strings in this // order params.addElement(act_guid); try { Globals.Log.debug("Liveness check for Actor:" + act_guid); xmlrpcClientConfig.setServerURL(new URL(registryUrl + "/")); // Set identity for SSL. RemoteRegistryCache.getMultiKeyManager().setCurrentGuid(act_guid); // FIXME: Parse the return? (STATUS: SUCCESS or STATUS: ERROR) String status = (String) xmlrpcClient.execute(xmlrpcClientConfig, registryMethod, params); Globals.Log.info("XMLRPC registry returned heartbeat status: " + status); } catch (MalformedURLException mue) { Globals.Log.error("Registry server URL is invalid.", mue); } catch (Exception ex) { Globals.Log.error("Could not connect to the registry server; registry server may be down", ex); } } catch (Exception e) { Globals.Log.error("Registry1: An error occurred while attempting to send heartbeats for actor: " + act_guid + " to external registry", e); } } }
/** * @param uri * the {@link URI} to connect to * @param interfaceClass * the class literal for the XML-RPC interface */ public Client(URI uri, Class<T> interfaceClass) { this.uri = uri; XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); try { config.setServerURL(uri.toURL()); } catch (MalformedURLException e) { throw new RosRuntimeException(e); } config.setConnectionTimeout(CONNECTION_TIMEOUT); config.setReplyTimeout(REPLY_TIMEOUT); XmlRpcClient client = new XmlRpcClient(); client.setTransportFactory(new XmlRpcCommonsTransportFactory(client)); client.setConfig(config); XmlRpcClientFactory<T> factory = new XmlRpcClientFactory<T>(client); xmlRpcEndpoint = interfaceClass.cast(factory.newInstance(getClass().getClassLoader(), interfaceClass, "", XMLRPC_TIMEOUT)); }
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; }
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); try { config.setServerURL(new URL("http://localhost:80")); config.setEnabledForExceptions(true); config.setEnabledForExtensions(true); //Add this line XmlRpcClient client = new XmlRpcClient(); client.setConfig(config); Object[] params = new Object[] { new Integer(11), new Integer(3), }; Integer result = (Integer) client.execute(config,"test.sum", params); System.out.println("Results " + result); } catch (XmlRpcException exception) { System.out.println(exception.getMessage()); Throwable cause = exception.getCause(); if(cause != null) { if(cause instanceof MyException) { System.out.println(((MyException)cause).getMessage()); } else { System.out.println("Cause not instance of Exception."); } } else { System.out.println("Cause was null."); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace();
/** * Helper method to get the XML RPC client * * @param url String * @return XmlRpcClient */ private XmlRpcClient getClient(String url) { XmlRpcClient client = null; try { client = new XmlRpcClient(); XmlRpcClientConfigImpl conf = new XmlRpcClientConfigImpl(); conf.setServerURL(new URL(url)); conf.setEncoding("UTF-8"); client.setConfig(conf); } catch (MalformedURLException exception) { throw new BlogIntegrationRuntimeException("Blog url '" + url + "' is invalid.", exception); } return client; }
/** * Creates a new instance of {@link XmlRpcClientConfig}. */ public static XmlRpcClientConfig newXmlRpcClientConfig() { return new XmlRpcClientConfigImpl(); }
private XmlRpcClientConfig getClientConfig(URL apiURL) { XmlRpcClientConfigImpl config; config = new XmlRpcClientConfigImpl(); config.setServerURL(apiURL); return config; }
public org.apache.xmlrpc.client.XmlRpcClient getRpcClient(String url, String login, String password) throws MalformedURLException { XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(new URL(url)); if (login != null) { config.setBasicUserName(login); } if (password != null) { config.setBasicPassword(password); } if (keyStoreComponent != null && keyStoreName != null && keyAlias != null) { return new XmlRpcClient(config, keyStoreComponent, keyStoreName, keyAlias); } return new XmlRpcClient(config); } }