aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes How to call an XML-RPC method  from  Java Code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to call an XML-RPC method  from  Java Code " Watch "How to call an XML-RPC method  from  Java Code " New topic
Author

How to call an XML-RPC method from Java Code

Sreekanth Kalakanti
Greenhorn

Joined: Sep 09, 2009
Posts: 12

Hi everyone,

I need to call a remote method getUserDetails methods of an API (lets say XAPI) the request for this in the XMl format is given as below:
<request version="2.0">
<target name="XAPI" operation="getUserDetails">
<parameters>
<user>xxxx</user>
<domain>
<name>abc.com</name>
</domain>
</parameters>
</target>
</request/>
[/code]
so from my Java code how do i need to construt the parameters for the above xml request with username and domain as parameters.

My java code looks like

[code=java] XmlRpcClient server = new XmlRpcClient("http://100.100.200.500:8080/");

Vector params = new Vector();
params.addElement(new String("xxxx"));
params.addElement(new String("abc.com"));
Object errorCode = server.execute("XAPI.getUserDetails", params);
[/code]

I am able to connect to the Xml-Rpc Server(http://100.100.200.500:8080/), but i am getting Invalid Parameters as Response . My Doubt here is how to set those parameter values as in the above xml format and send to XML-RPC server? so any one can guide me so that i can move in a Right path.

Thanks &Regards,
Srikanth


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to call an XML-RPC method from Java Code