Search code examples
javaapachexml-rpc

Generate XML-RPC as String in Java


This is what I want to do: I have a method name and parameter types and I want to have the XML-RPC as a String (and not send it!).

Like this... String someGreatThing.generate("bla.doStuff", String, int) and this is what I want to have then:

<?xml version="1.0"?>
 <methodCall>
   <methodName>bla.doStuff</methodName>
   <params>
     <param>
       <value><string></string></value>
     </param>
     <param>
       <value><int></int></value>
     </param>
   </params>
 </methodCall>

I just need the String.

Any idea if some library can do that? Preferably the XML-RPC libs from Apache, because I use them anyway.

Thank you!


Solution

  • You can do something like that with XStream: http://x-stream.github.io/ . But it is more general purpose, not XML-RPC specific.