Tabnine Logo
org.apache.xmlrpc.client
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.xmlrpc.client

Best Java code snippets using org.apache.xmlrpc.client (Showing top 20 results out of 378)

origin: stackoverflow.com

 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);
origin: apache/cloudstack

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;
}
origin: apache/cloudstack

public Object callTimeoutInSec(String method, List<?> params, int timeout,
    boolean debug) throws XmlRpcException {
  TimingOutCallback callback = new TimingOutCallback(timeout * 1000);
  if (debug) {
    LOGGER.debug("Call Ovm3 agent " + hostName + "(" + hostIp +"): " + method
  try {
    XmlRpcClientRequestImpl req = new XmlRpcClientRequestImpl(
        xmlClient.getClientConfig(), method, params);
    xmlClient.executeAsync(req, callback);
    return callback.waitForResponse();
  } catch (TimingOutCallback.TimeoutException e) {
    LOGGER.info("Timeout: ", e);
    throw new XmlRpcException(e.getMessage());
  } catch (XmlRpcException e) {
    LOGGER.info("XML RPC Exception occured: ", e);
origin: rometools/rome

private XmlRpcClient getXmlRpcClient() {
  if (xmlRpcClient == null) {
    final XmlRpcClientConfigImpl xmlrpcConfig = new XmlRpcClientConfigImpl();
    xmlrpcConfig.setServerURL(url);
    xmlRpcClient = new XmlRpcClient();
    xmlRpcClient.setConfig(xmlrpcConfig);
  }
  return xmlRpcClient;
}
origin: org.renci.ahab/libtransport

private XmlRpcClient getConfiguredClient() {
  XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
  config.setServerURL(cUrl);
  XmlRpcClient client = new XmlRpcClient();
  client.setConfig(config);
  // set this transport factory for host-specific SSLContexts to work
  XmlRpcCommonsTransportFactory f = new XmlRpcCommonsTransportFactory(client);
  client.setTransportFactory(f);
  
  return client;
}

origin: org.sonatype.sisu.jira.mediator/sisu-jira-mediator

private XmlRpcClient client()
{
  if ( this.client == null )
  {
    XmlRpcClientConfigImpl clientConfig = new XmlRpcClientConfigImpl();
    clientConfig.setServerURL( url );
    client = new XmlRpcClient();
    client.setTransportFactory( new XmlRpcAhcTransportFactory( client ) );
    client.setConfig( clientConfig );
  }
  return client;
}
origin: xmlrpc/xmlrpc-client

/** Performs a request with the given configuration.
 * @param pConfig The request configuration.
 * @param pMethodName The method being performed.
 * @param pParams The parameters.
 * @return The result object.
 * @throws XmlRpcException Performing the request failed.
 */
public Object execute(XmlRpcClientConfig pConfig, String pMethodName, List pParams) throws XmlRpcException {
  return execute(new XmlRpcClientRequestImpl(pConfig, pMethodName, pParams));
}
origin: org.apache.xmlrpc/xmlrpc-client

/** Performs an asynchronous request with the given configuration.
 * @param pConfig The request configuration.
 * @param pMethodName The method being performed.
 * @param pParams The parameters.
 * @param pCallback The callback being notified when the request is finished.
 * @throws XmlRpcException Performing the request failed.
 */
public void executeAsync(XmlRpcClientConfig pConfig,
             String pMethodName, List pParams,
             AsyncCallback pCallback) throws XmlRpcException {
  executeAsync(new XmlRpcClientRequestImpl(pConfig, pMethodName, pParams), pCallback);
}
origin: apache/cloudstack

public Object callTimeoutInSec(String method, Object[] params, int timeout, boolean debug) throws XmlRpcException {
  TimingOutCallback callback = new TimingOutCallback(timeout * 1000);
  Object[] mParams = new Object[params.length + 1];
  mParams[0] = method;
  for (int i = 0; i < params.length; i++) {
    mParams[i + 1] = params[i];
  }
  if (debug) {
    /*
     * some parameters including user password should not be printed in log
     */
    s_logger.debug("Call Ovm agent: " + Coder.toJson(mParams));
  }
  long startTime = System.currentTimeMillis();
  _client.executeAsync("OvmDispatch", mParams, callback);
  try {
    return callback.waitForResponse();
  } catch (TimingOutCallback.TimeoutException to) {
    throw to;
  } catch (Throwable e) {
    throw new XmlRpcException(-2, e.getMessage());
  } finally {
    long endTime = System.currentTimeMillis();
    long during = (endTime - startTime) / 1000; // in secs
    s_logger.debug("Ovm call " + method + " finished in " + String.valueOf(during) + " secs");
  }
}
origin: org.apache.xmlrpc/xmlrpc-client

  public XmlRpcTransport getTransport() {
    XmlRpcSun15HttpTransport transport = new XmlRpcSun15HttpTransport(getClient());
    transport.setSSLSocketFactory(getSSLSocketFactory());
    transport.setProxy(proxy);
    return transport;
  }
}
origin: stackoverflow.com

pWriter.write(baos);
log.info(baos.toString());
super.writeRequest(pWriter);
origin: org.apache.xmlrpc/xmlrpc-client

/** Creates a new instance.
 * @param pFactory The factory, which created this transport.
 */
public XmlRpcCommonsTransport(XmlRpcCommonsTransportFactory pFactory) {
  super(pFactory.getClient(), userAgent);
  HttpClient httpClient = pFactory.getHttpClient();
  if (httpClient == null) {
    httpClient = newHttpClient();
  }
  client = httpClient;
 }
origin: org.apache.xmlrpc/xmlrpc-client

  public XmlRpcTransport getTransport() {
    XmlRpcLite14HttpTransport transport = new XmlRpcLite14HttpTransport(getClient());
    transport.setSSLSocketFactory(sslSocketFactory);
    return transport;
  }
}
origin: apache/cloudstack

  @Override
  protected Map dispatch(String methodcall, Object[] methodparams)  throws XmlRpcException, XenAPIException {
    if (methodcall.equals("session.local_logout")
        || methodcall.equals("session.slave_local_login_with_password")
        || methodcall.equals("session.logout")
        || methodcall.equals("session.login_with_password")) {
      return super.dispatch(methodcall, methodparams);
    }
    try {
      return super.dispatch(methodcall, methodparams);
    } catch (Types.SessionInvalid e) {
      s_logger.debug("Session is invalid for method: " + methodcall + " due to " + e.toString());
      removeConnect(_poolUuid);
      throw e;
    } catch (XmlRpcClientException e) {
      s_logger.debug("XmlRpcClientException for method: " + methodcall + " due to " + e.toString());
      removeConnect(_poolUuid);
      throw e;
    } catch (XmlRpcException e) {
      s_logger.debug("XmlRpcException for method: " + methodcall + " due to " + e.toString());
      removeConnect(_poolUuid);
      throw e;
    } catch (Types.HostIsSlave e) {
       s_logger.debug("HostIsSlave Exception for method: " + methodcall + " due to " + e.toString());
       removeConnect(_poolUuid);
       throw e;
    }
  }
}
origin: apache/cloudstack

private XmlRpcClient setupXmlClient() {
  final XmlRpcClient client = new XmlRpcClient();
    xmlClientConfig.setTimeZone(TimeZone.getTimeZone("UTC"));
    xmlClientConfig.setServerURL(url);
    xmlClientConfig.setReplyTimeout(0);
    xmlClientConfig.setConnectionTimeout(60000);
    xmlClientConfig.setReplyTimeout(60 * 15000);
    if (hostUser != null && hostPass != null) {
      LOGGER.debug("Setting username " + hostUser);
      xmlClientConfig.setBasicUserName(hostUser);
      xmlClientConfig.setBasicPassword(hostPass);
    xmlClientConfig.setXmlRpcServer(null);
    client.setConfig(xmlClientConfig);
    client.setTypeFactory(new RpcTypeFactory(client));
  } catch (MalformedURLException e) {
    LOGGER.info("Incorrect URL: ", e);
origin: rometools/rome

private XmlRpcClient getXmlRpcClient() {
  if (xmlRpcClient == null) {
    final XmlRpcClientConfigImpl xmlrpcConfig = new XmlRpcClientConfigImpl();
    xmlrpcConfig.setServerURL(url);
    xmlRpcClient = new XmlRpcClient();
    xmlRpcClient.setConfig(xmlrpcConfig);
  }
  return xmlRpcClient;
}
origin: org.apache.xmlrpc/xmlrpc-client

/** Performs a request with the given configuration.
 * @param pConfig The request configuration.
 * @param pMethodName The method being performed.
 * @param pParams The parameters.
 * @return The result object.
 * @throws XmlRpcException Performing the request failed.
 */
public Object execute(XmlRpcClientConfig pConfig, String pMethodName, Object[] pParams) throws XmlRpcException {
  return execute(new XmlRpcClientRequestImpl(pConfig, pMethodName, pParams));
}
origin: xmlrpc/xmlrpc-client

/** Performs an asynchronous request with the given configuration.
 * @param pConfig The request configuration.
 * @param pMethodName The method being performed.
 * @param pParams The parameters.
 * @param pCallback The callback being notified when the request is finished.
 * @throws XmlRpcException Performing the request failed.
 */
public void executeAsync(XmlRpcClientConfig pConfig,
             String pMethodName, List pParams,
             AsyncCallback pCallback) throws XmlRpcException {
  executeAsync(new XmlRpcClientRequestImpl(pConfig, pMethodName, pParams), pCallback);
}
origin: org.apache.xmlrpc/xmlrpc-client

/** Performs a request with the given configuration.
 * @param pConfig The request configuration.
 * @param pMethodName The method being performed.
 * @param pParams The parameters.
 * @return The result object.
 * @throws XmlRpcException Performing the request failed.
 */
public Object execute(XmlRpcClientConfig pConfig, String pMethodName, List pParams) throws XmlRpcException {
  return execute(new XmlRpcClientRequestImpl(pConfig, pMethodName, pParams));
}
origin: xmlrpc/xmlrpc-client

/** Performs a request with the given configuration.
 * @param pConfig The request configuration.
 * @param pMethodName The method being performed.
 * @param pParams The parameters.
 * @return The result object.
 * @throws XmlRpcException Performing the request failed.
 */
public Object execute(XmlRpcClientConfig pConfig, String pMethodName, Object[] pParams) throws XmlRpcException {
  return execute(new XmlRpcClientRequestImpl(pConfig, pMethodName, pParams));
}
org.apache.xmlrpc.client

Most used classes

  • XmlRpcClient
    The main access point of an XML-RPC client. This object serves mainly as an object factory. It is de
  • XmlRpcClientConfigImpl
    Default implementation of a clients request configuration.
  • XmlRpcCommonsTransportFactory
    An HTTP transport factory, which is based on the Jakarta Commons HTTP Client.
  • XmlRpcClientException
    This is thrown by many of the client classes if an error occured processing and XML-RPC request or r
  • XmlRpcStreamTransport$ReqWriter
  • XmlRpcHttpClientConfig,
  • XmlRpcHttpTransport,
  • XmlRpcStreamTransport$GzipReqWriter,
  • XmlRpcStreamTransport$ReqWriterImpl,
  • XmlRpcStreamTransport,
  • ClientFactory,
  • TimingOutCallback$TimeoutException,
  • XmlRpcAhcTransportFactory,
  • XmlRpcClientWorker,
  • XmlRpcClientWorkerFactory,
  • XmlRpcHttpTransport$ByteArrayReqWriter,
  • XmlRpcSunHttpTransport,
  • XmlRpcTransport,
  • XmlRpcTransportFactory
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now