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()); }
public static short connectToBugTrackingXmlRpcServer() { try { XmlRpcClientConfigImpl xmlRpcClientConfig = new XmlRpcClientConfigImpl(); xmlRpcClientConfig.setServerURL(new URL(CStudioGlobals.bugTrackingConfProperties.getUrlXmlRpcServer())); xmlRpcClientConfig.setBasicUserName(CStudioGlobals.bugTrackingConfProperties.getUsername()); xmlRpcClientConfig.setBasicPassword(CStudioGlobals.bugTrackingConfProperties.getPassword()); xmlRpcClientConfig.setEncoding("UTF-8"); XmlRpcClient xmlRpcClient = new XmlRpcClient(); xmlRpcClient.setConfig(xmlRpcClientConfig); CTrackerDynamicProxy xmlRpcProxy = new CTrackerDynamicProxy(xmlRpcClient); Ticket ticket = (Ticket)xmlRpcProxy.newInstance(Ticket.class); ticket.query(); // query some tickets return CONNECTION_SUCCESS; } catch (Throwable t) { t.printStackTrace(); displayError(CStudioGlobals.localization.getTerm("error.title.Sql_error"), CStudioGlobals.localization.getTerm("error.content._Invalid_connection"), CStudioGlobals.localization.getTerm("error.resolution.Check_your_connection_settings")); return CONNECTION_RETRY; } }
/** * 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; }
/** * 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; }
protected void createXmlRpcClient() { config = new XmlRpcClientConfigImpl(); config.setEncoding(DEFAULT_CHARSET); config.setTimeZone(TimeZone.getTimeZone(DEFAULT_TIME_ZONE)); config.setContentLengthOptional(false);
xmlRpcClientConfig.setEncoding(appConfig.getString(XMLRPC_ENCODING));