Bugzilla Xml Rpc Java Example

Best Java code snippets using org.apache.xmlrpc.client.XmlRpcClient.<init> (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
                    

private void myMethod ()

{

}

                                                                                                                                                                                                                            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);                                  
                                                                                                                                              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                                                              );                                                                                                                                                                                                                                                                            _config.setConnectionTimeout(                                                              6000                                                              );                                                                                                                      _config.setBasicUserName(_username);                                                                            _config.setBasicPassword(_password);                                                                            client.setConfig(_config);                                                                                                                          }                                                                                    catch                                                                                      (MalformedURLException e) {                                                                                                                                                                                                                                throw                                                                                                                                                  new                                                                                      CloudRuntimeException(e.getMessage());                                                                                                                      }                                                                                                                                                                                                                                              return                                                                                      client;                                                                                                  }                                                                                          
                                                                                                                                              private                                                                                      XmlRpcClient setupXmlClient() {                                                                                                                                                                                                                                final                                                                                      XmlRpcClient client =                                                                                    new                                                                                                                                                  XmlRpcClient                                                              ();                                                                                                                                    
                                                                                                                                              public                                                                                      AbstractLscXmlRpcClient() {                                                                                                                                                                    options =                                                                                    new                                                                                      Options();                                                                                                                                                                    options.addOption(                                                              "h"                                                              ,                                                                                    "hosturl"                                                              ,                                                                                    true                                                              ,                                                                                    "Specify the XML RPC server URL"                                                              );                                                                                                                                                                    options.addOption(                                                              "u"                                                              ,                                                                                    "username"                                                              ,                                                                                    true                                                              ,                                                                                    "Specify the username"                                                              );                                                                                                                                                                    options.addOption(                                                              "p"                                                              ,                                                                                    "password"                                                              ,                                                                                    true                                                              ,                                                                                    "Specify the password"                                                              );                                                                                                                                                                                                                            client =                                                                                    new                                                                                                                                                  XmlRpcClient                                                              ();                                                                                                  }                                                                                          
                                                                                                                                                                XmlRpcClient client =                                                                                    new                                                                                                                                                  XmlRpcClient                                                              ()                                                                                                                                            client.setTransportFactory(                                                              new                                                                                      XmlRpcTransportFactory(){                                                                                                                                                                              @Override                                                                                                                                                                                      public                                                                                      XmlRpcTransport getTransport() {                                                                                                                                                                                                                                                                                        return                                                                                                                                                  new                                                                                      XmlRpcSunHttpTransport(client){                                                                                                                                                                                                                                protected                                                                                      java.net.URLConnection getURLConnection(){                                                                                                                                                                    URLConnection urlConnection =                                                                                    super                                                              .getURLConnection();                                                                                                                                                                    urlConnection.setConnectTimeout(                                                              60000                                                              );                                                                                                                                                                    urlConnection.setReadTimeout(                                                              60000                                                              );                                                                                                                                                                                                                                return                                                                                      urlConnection;                                                                                                                      }                                                                            };                                                                                                                                    }});                                  
                                                                                                                                              private                                                                                      XmlRpcClient getRpcClient() {                                                                                                                      String apiURL = baseURL + API_URL;                                                                            XmlRpcClient rpcClient;                                                                                                                          rpcClient =                                                                                    new                                                                                                                                                  XmlRpcClient                                                              ();                                                                                                                                                                                                                                                                                        try                                                                                      {                                                                                                                                                                    URL url =                                                                                    new                                                                                      URL(apiURL);                                                                                                                      rpcClient.setConfig(getClientConfig(url));                                                                                                                          }                                                                                    catch                                                                                      (MalformedURLException e) {                                                                                                                      Utils.logException(LOG, e);                                                                                                                                                                                      throw                                                                                                                                                  new                                                                                      RuntimeException(e);                                                                                                                      }                                                                                                                                                                                      return                                                                                      rpcClient;                                                                                                  }                                                                                          
                                                                                                                                              public                                                                                                                                                  static                                                                                      XmlRpcClient getXMLRPCClient(String rpcUrl)                                                                                    throws                                                                                      MalformedURLException {                                                                                                                                                                                                                            XmlRpcClientConfigImpl config =                                                                                    new                                                                                      XmlRpcClientConfigImpl();                                                                                                                                                                    config.setServerURL(                                                              new                                                                                      URL(rpcUrl));                                                                                                                                                                    XmlRpcClient client =                                                                                    new                                                                                                                                                  XmlRpcClient                                                              ();                                                                                                                      client.setConfig(config);                                                                                                                                                                                      return                                                                                      client;                                                                                                  }                                                                                          
                                                                                                                                              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"                                                              );                                                                                                                                                                                                                                                                            config.setEnabledForExceptions(                                                              true                                                              );                                                                                                                                                                                                                            client =                                                                                    new                                                                                                                                                  XmlRpcClient                                                              ();                                                                                                                      client.setConfig(config);                                                                                                                                                                                      this                                                              .logger = LoggerFactory.getLogger(getClass().getCanonicalName() +                                                                                    "-"                                                                                      + url.getHost());                                                                                                  }                                                                                          
                                                                                                                                              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);                                                        }                                                                                          
                                                                                                                                              private                                                                                      XmlRpcClient getXmlRpcClient() {                                                                                                                                                                                                                                                                                        if                                                                                      (xmlRpcClient == null) {                                                                                                                                                                                                                                final                                                                                      XmlRpcClientConfigImpl xmlrpcConfig =                                                                                    new                                                                                      XmlRpcClientConfigImpl();                                                                                                                      xmlrpcConfig.setServerURL(url);                                                                                                                          xmlRpcClient =                                                                                    new                                                                                                                                                  XmlRpcClient                                                              ();                                                                                                                      xmlRpcClient.setConfig(xmlrpcConfig);                                                                            }                                                                                                                                                                                      return                                                                                      xmlRpcClient;                                                                                                  }                                                                                          
                                                                                                                                              private                                                                                      XmlRpcClient getXmlRpcClient() {                                                                                                                                                                                                                                if                                                                                      (xmlRpcClient == null) {                                                                                                                                                                                                                                final                                                                                      XmlRpcClientConfigImpl xmlrpcConfig =                                                                                    new                                                                                      XmlRpcClientConfigImpl();                                                                                                                      xmlrpcConfig.setServerURL(url);                                                                                                                          xmlRpcClient =                                                                                    new                                                                                                                                                  XmlRpcClient                                                              ();                                                                                                                      xmlRpcClient.setConfig(xmlrpcConfig);                                                                            }                                                                                                                                                                                      return                                                                                      xmlRpcClient;                                                                                                  }                                                                                          
                                                                                                                                              private                                                                                      XmlRpcClient getClient(URL url) {                                                                                                                                                                    XmlRpcClient client =                                                                                    new                                                                                                                                                  XmlRpcClient                                                              ();                                                                                                                                                                    XmlRpcClientConfigImpl config =                                                                                    new                                                                                      XmlRpcClientConfigImpl();                                                                                                                      config.setServerURL(url);                                                                            client.setConfig(config);                                                                                                                                                                                      return                                                                                      client;                                                                                                  }                                                                                          
                                                                                                                                              public                                                                                                                                                  static                                                                                                                                                  void                                                                                      main(String[] args)                                                                                    throws                                                                                      MalformedURLException {                                                                                                                                                                    XmlRpcClient xmlRpcClient =                                                                                    new                                                                                                                                                  XmlRpcClient                                                              ();                                                                                                                                                                    XmlRpcClientConfigImpl pConfig =                                                                                    new                                                                                      XmlRpcClientConfigImpl();                                                                                                                                                                    pConfig.setServerURL(                                                              new                                                                                      URL(                                                              "http://localhost:3300/testlink-1.9.6/lib/api/xmlrpc.php"                                                              ));                                                                                                                      xmlRpcClient.setConfig(pConfig);                                                                                                                          TestProjectService service =                                                                                    new                                                                                      TestProjectService(xmlRpcClient,                                                                                    "09b83b6813a55ef6f7e2d7d63cb6f65c"                                                              );                                                                                                                                                                    Platform[] platforms = service.getProjectPlatforms(                                                              2                                                              );                                                                                                                                                                                                                                for                                                                                      (Platform platform : platforms) {                                                                                                                      System.out.println(platform);                                                                            }                                                        }                                                                                          
                                                                                                                                              public                                                                                                                                                  static                                                                                                                                                  void                                                                                      main(String[] args)                                                                                    throws                                                                                      MalformedURLException {                                                                                                                                                                    XmlRpcClient xmlRpcClient =                                                                                    new                                                                                                                                                  XmlRpcClient                                                              ();                                                                                                                                                                    XmlRpcClientConfigImpl pConfig =                                                                                    new                                                                                      XmlRpcClientConfigImpl();                                                                                                                                                                    pConfig.setServerURL(                                                              new                                                                                      URL(                                                              "http://localhost:3300/testlink-1.9.6/lib/api/xmlrpc.php"                                                              ));                                                                                                                      xmlRpcClient.setConfig(pConfig);                                                                                                                          TestPlanService service =                                                                                    new                                                                                      TestPlanService(xmlRpcClient,                                                                                    "09b83b6813a55ef6f7e2d7d63cb6f65c"                                                              );                                                                                                                                                                    Map<?, ?> message = service.addPlatformToTestPlan(                                                              2                                                              ,                                                                                    8                                                              ,                                                                                    "browser"                                                              );                                                                                                                      System.out.println(message);                                                        }                                                                                          
                                      @Override                                                                                                                                                                public                                                                                                                                                  void                                                                                      connectToExternal()                                                                                    throws                                                                                      ComponentException {                                                                                                                                                                    client =                                                                                    new                                                                                                                                                  XmlRpcClient                                                              ();                                                                                                                                                                    XmlRpcClientConfigImpl config =                                                                                    new                                                                                      XmlRpcClientConfigImpl();                                                                                                                                                                                                                                try                                                                                      {                                                                                                                                                                    config.setServerURL(                                                              new                                                                                      URL(getConfig().getExternalConnectionString()));                                                                                                                      client.setConfig(config);                                                                                                                          }                                                                                    catch                                                                                      (MalformedURLException ex) {                                                                                                                                                                    LOGGER.error(                                                              "Exception occurred: {}"                                                              , ex.toString());                                                                                                                      }                                                        }                                                                                          
                                                                                                                                        XmlRpcClientConfigImpl config =                                                                                    new                                                                                      XmlRpcClientConfigImpl();                                                                                                                                            XmlRpcClient client =                                                                                    new                                                                                                                                                  XmlRpcClient                                                              ();                                                                                                                                                                                                          try                                                                                      {                                                                                                                                                                    config.setServerURL(                                                              new                                                                                      URL(                                                              "http://localhost:8080/RPC2"                                                              ));                                                                                                                                                                    config.setBasicUserName(                                                              "freeswitch"                                                              );                                                                                                                                                                    config.setBasicPassword(                                                              "works"                                                              );                                                                                                                                                                              client.setConfig(config);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      client.execute(                                                              "freeswitch.api"                                                              ,                                                                                    new                                                                                      Object[]{                                                              "originate"                                                              ,                                                                                    "sofia/internal/1001 &park()"                                                              });                                                                                                                                                                                                    }                                                                                    catch                                                                                      (Exception ex) {                                                                                                                      ex.printStackTrace();                                                        }                                  
                                                                                                                                              protected                                                                                      <X> X call(String username, String password, String path, String methodName, Object... args) {                                                                                                                                                                                                                                try                                                                                      {                                                                                                                                                                    URL url =                                                                                    new                                                                                      URL(getTestBoot().getSettings().getFathomUrl() + StringUtils.removeStart(path,                                                                                    "/"                                                              ));                                                                                                                                                                    XmlRpcClientConfigImpl config =                                                                                    new                                                                                      XmlRpcClientConfigImpl();                                                                                                                      config.setBasicUserName(username);                                                                            config.setBasicPassword(password);                                                                            config.setServerURL(url);                                                                                                                          XmlRpcClient xmlrpc =                                                                                    new                                                                                                                                                  XmlRpcClient                                                              ();                                                                                                                      xmlrpc.setConfig(config);                                                                            Object x = xmlrpc.execute(methodName, args);                                                                                                                                                                                      return                                                                                      (X) x;                                                                                                                                                                    }                                                                                    catch                                                                                      (Exception e) {                                                                                                                                                                                                                                throw                                                                                                                                                  new                                                                                      RuntimeException(e);                                                                                                                      }                                                        }                                                                                          
                                                                                                                                              private                                                                                      XmlRpcClient getConfiguredClient() {                                                                                                                                                                    XmlRpcClientConfigImpl config =                                                                                    new                                                                                      XmlRpcClientConfigImpl();                                                                                                                      config.setServerURL(cUrl);                                                                                                                          XmlRpcClient client =                                                                                    new                                                                                                                                                  XmlRpcClient                                                              ();                                                                                                                      client.setConfig(config);                                                                                                                                                                                                                                                                                                                                                                                                                                      XmlRpcCommonsTransportFactory f =                                                                                    new                                                                                      XmlRpcCommonsTransportFactory(client);                                                                                                                      client.setTransportFactory(f);                                                                                                                                                                                                                                              return                                                                                      client;                                                                                                  }                                                                                          
                                                                                                                                              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;                                                                                                                                                          }                                                                                          
                                                                                                                                              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));                                                                                                                                                                                                                                                                                                                                                                                                                                                                                XmlRpcCommonsTransportFactory f =                                                                                    new                                                                                      XmlRpcCommonsTransportFactory(client);                                                                                                                      client.setTransportFactory(f);                                                                                                                                                                                                                                              return                                                                                      client;                                                                                                  }                                                                                          

behancaments1948.blogspot.com

Source: https://www.tabnine.com/code/java/methods/org.apache.xmlrpc.client.XmlRpcClient/%3Cinit%3E

0 Response to "Bugzilla Xml Rpc Java Example"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel