简体   繁体   English

在Java中生成XML-RPC as String

[英]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!). 这就是我想要做的:我有一个方法名称和参数类型,我希望将XML-RPC作为String(而不是发送它!)。

Like this... String someGreatThing.generate("bla.doStuff", String, int) and this is what I want to have then: 像这样...... String someGreatThing.generate(“bla.doStuff”,String,int),这就是我想拥有的:

<?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. 我只需要String。

Any idea if some library can do that? 知道某些图书馆能做到吗? Preferably the XML-RPC libs from Apache, because I use them anyway. 最好是来自Apache的XML-RPC库,因为无论如何我都使用它们。

Thank you! 谢谢!

You can do something like that with XStream: http://x-stream.github.io/ . 您可以使用XStream执行类似的操作: http//x-stream.github.io/ But it is more general purpose, not XML-RPC specific. 但它更通用,而不是特定于XML-RPC。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM