Package org.apache.xmlrpc

Examples of org.apache.xmlrpc.XmlRpcClient$CallData


 
  public void makeCall()
  {
    try
    {
      XmlRpcClient xmlrpc = new XmlRpcClient(serviceUrl);
      XmlRpc.setEncoding("ISO-8859-1");
      //Vector params = new Vector ();
      //params.addElement("7");
      //params.addElement("peew9yoop");
      //params.addElement("1");
     
      // this method returns a string
      this.result = xmlrpc.execute(this.method, this.parameters);
     
      logger.info("result:" + result);
    }
    catch(Exception e)
    {
View Full Code Here


        String xmlRpcURL = "http://" + hostPort + serviceLocation;
        try {
            if (log.isDebugEnabled()) {
                log.debug("Using URI: '" + xmlRpcURL + "'");
            }
            XmlRpcClient client = new XmlRpcClient(xmlRpcURL);
            if (basicUser != null) {
                client.setBasicAuthentication(basicUser, basicPassword);
            }
            return client;
        } catch (MalformedURLException e) {
            throw new XMLDBException(ErrorCodes.INVALID_URI, e);
        }
View Full Code Here

                             Vector params)
        throws TurbineException
    {
        try
        {
            XmlRpcClient client = new XmlRpcClient ( url );
            return client.execute(methodName, params);
        }
        catch (Exception e)
        {
            throw new TurbineException("XML-RPC call failed", e);
        }
View Full Code Here

                             Vector params)
        throws TurbineException
    {
        try
        {
            XmlRpcClient client = new XmlRpcClient ( url );
            client.setBasicAuthentication(username, password);
            return client.execute(methodName, params);
        }
        catch (Exception e)
        {
            throw new TurbineException("XML-RPC call failed", e);
        }
View Full Code Here

        RemoteWikiBroker rwb = RemoteWikiBroker.getInstance();
        String uniqueId = getUniqueString();
        String title = "testing-update-" + uniqueId;

        //explicitly check that page does not exist - XXX not sure we're testing this right in conf4
        XmlRpcClient client = new XmlRpcClient("http://" + confSettings.url + "/rpc/xmlrpc");
        Vector paramsVector = new Vector();
        String loginToken = rwb.getLoginToken(confSettings);
        paramsVector.add(loginToken);
        paramsVector.add(confSettings.spaceKey);
        paramsVector.add(title);
        Hashtable retpage = null;
        try  {
          retpage = (Hashtable) client.execute("confluence1.getPage", paramsVector);
          fail();
        } catch (XmlRpcException e) {}
       
        //create page first time
        PageForXmlRpc page = new PageForXmlRpc();
    page.setTitle(title);
        String content1 = "this is some content " + uniqueId;
    page.setContent(content1);
        rwb.storeNewOrUpdatePage(confSettings, confSettings.spaceKey, page);
       
        try  {
          retpage = (Hashtable) client.execute("confluence1.getPage", paramsVector);
          assertNotNull(retpage);
          assertEquals(title, (String) retpage.get("title"));
          assertEquals(content1, (String) retpage.get("content")); //not allowed as of Conf 4
        } catch (XmlRpcException e) {
          try {
            retpage = (Hashtable) client.execute("confluence1.getPageSummary", paramsVector);
            assertNotNull(retpage);
            assertEquals(title, (String) retpage.get("title"));
            //assertEquals(content1, (String) retpage.get("content")); //not allowed as of Conf 4
          } catch (XmlRpcException e1) {
            fail();
          }
        }
       
        //update page
        page = new PageForXmlRpc();
        page.setTitle(title);
        String content2 = "this is some UPDATED content " + uniqueId;
    page.setContent(content2);
        rwb.storeNewOrUpdatePage(confSettings, confSettings.spaceKey, page);
       
        try  {
          retpage = (Hashtable) client.execute("confluence1.getPage", paramsVector);
          assertNotNull(retpage);
          assertEquals(title, (String) retpage.get("title"));
          assertEquals(content2, (String) retpage.get("content"));
        } catch (XmlRpcException e) {
          try { //XXX not sure how to test this in conf4
            retpage = (Hashtable) client.execute("confluence1.getPageSummary", paramsVector);
            assertNotNull(retpage);
            assertEquals(title, (String) retpage.get("title"));
            //assertEquals(content1, (String) retpage.get("content")); //not allowed as of Conf 4
          } catch (XmlRpcException e1) {
            fail();
View Full Code Here

    public void testAddSSLSettings_Succeed() {
      if (numExclusiveTests++ > 0) fail("Only one 'exclusive' test can be run at a time.");
      confSettings.url = sslUrl;
      confSettings.spaceKey = sslSpace;
      String connectionURL = "https://" + sslUrl + "/rpc/xmlrpc";
        XmlRpcClient client = null;
    try {
      client = new XmlRpcClient(connectionURL);
    } catch (MalformedURLException e) {
      e.printStackTrace();
      fail();
    }
        assertNotNull(client);

        Vector loginParams = new Vector(2);
        loginParams.add(confSettings.login);
        loginParams.add(confSettings.password);
        String loginToken;

    //and here's what a proper ssl connection looks like
    tester.needNewLogin();
    tester.addSSLSettings(confSettings);
    try {
      loginToken = (String) client.execute("confluence1.login", loginParams);
      assertNotNull(loginToken);
      assertTrue(!"".equals(loginToken));
    } catch (Exception e) {
      e.printStackTrace();
      fail();
View Full Code Here

        RemoteWikiBroker rwb = RemoteWikiBroker.getInstance();
        String uniqueId = getUniqueString();
        String title = "testing-blog-" + uniqueId;

        //explicitly check that page does not exist
        XmlRpcClient client = new XmlRpcClient("http://" + confSettings.url + "/rpc/xmlrpc");
        Vector paramsVector = new Vector();
        String loginToken = rwb.getLoginToken(confSettings);
        paramsVector.add(loginToken);
        paramsVector.add(confSettings.spaceKey);
        int day = Calendar.getInstance().get(Calendar.DAY_OF_MONTH);
    paramsVector.add(day); //today's month
        paramsVector.add(title);
        Hashtable retblog = null;
        try  {
          retblog = (Hashtable) client.execute("confluence1.getBlogEntryByDayAndTitle", paramsVector);
          fail();
        } catch (XmlRpcException e) {}
       
        //create page first time
        BlogForXmlRpc blog = new BlogForXmlRpc();
    blog.setTitle(title);
        String content1 = "this is some content " + uniqueId;
    blog.setContent(content1);
    blog.setSpace(confSettings.spaceKey);
        rwb.storeBlog(confSettings, blog);
       
        try  {
          retblog = (Hashtable) client.execute("confluence1.getBlogEntryByDayAndTitle", paramsVector);
          assertNotNull(retblog);
          assertEquals(title, (String) retblog.get("title"));
          assertEquals(content1, (String) retblog.get("content"));
        } catch (XmlRpcException e) {
          fail();
        }
       
        //update blog
        blog = new BlogForXmlRpc();
        blog.setTitle(title);
        String content2 = "this is some UPDATED content " + uniqueId;
    blog.setContent(content2);
        rwb.storeBlog(confSettings, blog);
       
        try  {
          retblog = (Hashtable) client.execute("confluence1.getBlogEntryByDayAndTitle", paramsVector);
          assertNotNull(retblog);
          assertEquals(title, (String) retblog.get("title"));
          assertEquals(content2, (String) retblog.get("content"));
        } catch (XmlRpcException e) {
          fail();
View Full Code Here

    public void testAddSslSettings_Fail() {
      if (numExclusiveTests++ > 0) fail("Only one 'exclusive' test can be run at a time.");
      confSettings.url = sslUrl;
      confSettings.spaceKey = sslSpace;
      String connectionURL = "https://" + sslUrl + "/rpc/xmlrpc";
        XmlRpcClient client = null;
    try {
      client = new XmlRpcClient(connectionURL);
    } catch (MalformedURLException e) {
      e.printStackTrace();
      fail();
    }
        assertNotNull(client);

        Vector loginParams = new Vector(2);
        loginParams.add(confSettings.login);
        loginParams.add(confSettings.password);
        String loginToken;
       
        //establish what it looks like to connect to an SSL url without ssl settings
    try {
      loginToken = (String) client.execute("confluence1.login", loginParams);
      fail();
    } catch (SSLHandshakeException e) {
      //This is the correct code path
    } catch (XmlRpcException e) {
      fail();
View Full Code Here

      String uniqueId = getUniqueString();
      String title = "testing-move-" + uniqueId;
      String parentTitle  = "testing-move-parent-" + uniqueId;

      //explicitly check that pages do not exist
      XmlRpcClient client = new XmlRpcClient("http://" + confSettings.url + "/rpc/xmlrpc");
      Vector paramsVector = new Vector();
      String loginToken = rwb.getLoginToken(confSettings);
      paramsVector.add(loginToken);
      paramsVector.add(confSettings.spaceKey);
      paramsVector.add(title);
      Hashtable retpage = null;
      try  {
        retpage = (Hashtable) client.execute("confluence1.getPage", paramsVector);
        fail();
      } catch (XmlRpcException e) {}
      paramsVector.removeAllElements();
      paramsVector.add(loginToken);
      paramsVector.add(confSettings.spaceKey);
      paramsVector.add(parentTitle);
      try  {
        retpage = (Hashtable) client.execute("confluence1.getPage", paramsVector);
        fail();
      } catch (XmlRpcException e) {}
     
      //create page
      PageForXmlRpc page = new PageForXmlRpc();
      page.setTitle(title);
      String content1 = "this is some content " + uniqueId;
      page.setContent(content1);
      page = rwb.storeNewOrUpdatePage(confSettings, confSettings.spaceKey, page);

      //create another page (will be parent)
      PageForXmlRpc parent = new PageForXmlRpc();
      parent.setTitle(parentTitle);
      content1 = "parent page " + uniqueId;
      parent.setContent(content1);
      parent = rwb.storeNewOrUpdatePage(confSettings, confSettings.spaceKey, parent);

      //move page to parent
      try {
        boolean retval = rwb.movePage(confSettings, page.getId(), parent.getId(),
            RemoteWikiBroker.Position.APPEND);
        assertTrue(retval);
        //get the page object, and test that it's parent id is the parent page
        paramsVector.removeAllElements();
          paramsVector.add(loginToken);
          paramsVector.add(confSettings.spaceKey);
          paramsVector.add(title);
          try  {
            retpage = (Hashtable) client.execute("confluence1.getPage", paramsVector);
          } catch (XmlRpcException e) {}
          String id = (String) retpage.get("parentId");
          assertNotNull(id);
          assertEquals(parent.getId(), id);
      } catch (Exception e) {
View Full Code Here

      confSettings.spaceKey = sslSpace;
      confSettings.trustallcerts = "false";
      confSettings.truststore = "log4j.properties"; //valid file, but not a valid truststore
      confSettings.trustpass = "";
      String connectionURL = "https://" + sslUrl + "/rpc/xmlrpc";
      XmlRpcClient client = null;
      try {
        client = new XmlRpcClient(connectionURL);
      } catch (MalformedURLException e) {
        e.printStackTrace();
        fail();
      }
      assertNotNull(client);

      Vector loginParams = new Vector(2);
      loginParams.add(confSettings.login);
      loginParams.add(confSettings.password);
      String loginToken;

      //this should not connect. We have neither trustall set to true, nor valid truststore
      tester.addSSLSettings(confSettings);
      try {
        loginToken = (String) client.execute("confluence1.login", loginParams);
        fail();
      } catch (Exception e) {
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.xmlrpc.XmlRpcClient$CallData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.