[one-users] RPCXML response problem

Joey Ma majunjiev at gmail.com
Mon May 2 03:06:50 PDT 2011


Hi,

Maybe you should cast the returned type of Object to the OneResponse, "One
Response result = (OneResponse)client.execute( "one.vm.allocate", params );"
.
The java unit testing source code in java oca, located in
./src/oca/java/test, may helps you understanding the usage of  java methods
for xml-rpc calling.

Best Regards,
Joey

On Mon, May 2, 2011 at 5:57 PM, Giuseppe Carella <cargius at gmail.com> wrote:

> Hi all,
>
> I have a problem with XMLRPC API using it with JAVA.
> When I send a request to opennebula XMLRPC server, I receive
> a response like this:
>
> [Ljava.lang.Object;@19968e23
>
> How can I extract the vid from this response object?
>
> I have followed all the instructions in the java example of the web site.
>
> public class XmlRpcTest {
>     public static void main( String <http://www.google.com/search?hl=en&q=allinurl%3Astring+java.sun.com&btnI=I%27m%20Feeling%20Lucky> args[] ) throws Exception <http://www.google.com/search?hl=en&q=allinurl%3Aexception+java.sun.com&btnI=I%27m%20Feeling%20Lucky> {
>         XmlRpcClient client = new XmlRpcClient( "http://localhost:2633/RPC2" );
>         Vector <http://www.google.com/search?hl=en&q=allinurl%3Avector+java.sun.com&btnI=I%27m%20Feeling%20Lucky> params = new Vector <http://www.google.com/search?hl=en&q=allinurl%3Avector+java.sun.com&btnI=I%27m%20Feeling%20Lucky>();
>         params.addElement("SESSION-GOLA&4H910");
>         params.addElement("MEMORY=345 CPU=4 DISK=[FILE=\"img\",TYPE=cd]""DISK=[FILE=\"../f\"]");
>
>         Object <http://www.google.com/search?hl=en&q=allinurl%3Aobject+java.sun.com&btnI=I%27m%20Feeling%20Lucky> result = client.execute( "one.vm.allocate", params );
>
>         if ( result != null )
>             System <http://www.google.com/search?hl=en&q=allinurl%3Asystem+java.sun.com&btnI=I%27m%20Feeling%20Lucky>.out.println( result.toString() );
>     }}
>
>
> Your help is kindly appreciated!
>
> thanks,
>
> Giuseppe
>
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20110502/44691c11/attachment-0003.htm>


More information about the Users mailing list