title: Error getting XML&JSON result after java call to apache's xml-rpc client - unexpected non-whitespace character data
body: <p>I'm getting an odd error trying to make a method call in Java using Apache's Xml-Rpc library. Here's the setup:</p>
  
  <pre><code>XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
      URL url = null;
      try {
          url = new URL(Config.getInstance().getProperty("foo.host"));
      } catch (MalformedURLException e) {
          e.printStackTrace();
      }
      config.setServerURL(url);
  
      client = new XmlRpcClient();
      client.setConfig(config);
  
      //Generate Token for all admin calls
      try {
          token = (String) client.execute("confluence2.login",
                  new Object[]{ADMIN_USER, ADMIN_PASS});
      } catch (XmlRpcException e) {
          log.error("There was a problem getting the rpc token", e);
      }
  </code></pre>
  
  <p>The helper method used by multiple other methods, works for all others except the one in question:</p>
  
  <pre><code>private &lt;T&gt; T executeWikiMethod(String method, Object[] params) throws WikiException {
      try {
          Object[] args = new Object[params.length + 1];
          args[0] = token;
          System.arraycopy(params, 0, args, 1, args.length - 1);
  
          long startTime = System.currentTimeMillis();
          T t = (T) client.execute(method, args);
          log.debug(String.format("Wiki RPC call to method: %s and params: %s. Request completed in %dms", method, Arrays.toString(args), System.currentTimeMillis() - startTime));
  
          return t;
      } catch (XmlRpcException e) {
          throw new WikiException(e.getMessage());
      } catch (Exception e) {
          log.error(e.getMessage());
          throw new WikiException("An unexpected error occurred.");
      }
  }
  </code></pre>
  
  <p>And finally, here's the method that breaks with the error message "Failed to parse servers response: Unexpected non-whitespace character data":</p>
  
  <pre><code>public Object getWikiUpdates(String wikiSpaceKey) throws WikiException {
      Object result;
  
      result = executeWikiMethod("recentupdate.getRecentUpdate", new Object[]{wikiSpaceKey, "10"});
  
      return result;
  }
  </code></pre>
  
  <p>And the stack trace:</p>
  
  <pre><code>Failed to parse servers response: Unexpected non-whitespace character data
  at org.junit.Assert.fail(Assert.java:93)
  at miniWikiTest.updatesTest(miniWikiTest.java:21)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
  at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
  at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
  at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
  at play.test.PlayJUnitRunner$StartPlay$2$1.evaluate(PlayJUnitRunner.java:114)
  at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
  at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
  at play.test.PlayJUnitRunner.run(PlayJUnitRunner.java:58)
  at org.junit.runners.Suite.runChild(Suite.java:128)
  at org.junit.runners.Suite.runChild(Suite.java:24)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
  at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
  at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
  at org.junit.runner.JUnitCore.run(JUnitCore.java:136)
  at org.junit.runner.JUnitCore.run(JUnitCore.java:117)
  at play.test.TestEngine.run(TestEngine.java:112)
  at controllers.TestRunner$1.doJobWithResult(TestRunner.java:71)
  at controllers.TestRunner$1.doJobWithResult(TestRunner.java:1)
  at play.jobs.Job.call(Job.java:146)
  at play.jobs.Job$1.call(Job.java:66)
  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
  at java.util.concurrent.FutureTask.run(FutureTask.java:138)
  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
  at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
  at java.lang.Thread.run(Thread.java:695)
  </code></pre>
  
  <p>There should be an xml response from the server which is parsed to a JSON object using the RPC library. The getWikiUpdates() method should be returning a JSON block representing a few different types of updates to a wiki page (such as new comment, etc.) whose format is unknown at the moment because the call returns an error without an xml response or any of the JSON. I'm using Object in hopes of being able to catch what is returned from the method call and be able to format the results from there. This is all being done in the Play! framework. Please let me know if I need to clarify anything further, thanks.</p>
  
  <p>edit - The server response is "Unexpected non-whitespace character data", nothing else</p>