Hi,<div><br></div><div>Maybe you should cast the returned type of Object to the OneResponse, "One<span class="Apple-style-span" style="color: rgb(85, 85, 85); font-family: monospace; font-size: 13px; line-height: 18px; white-space: pre; "><span style="text-decoration: none; font-size: 1em; color: rgb(0, 0, 102); ">Response</span> result <span style="color: rgb(102, 204, 102); ">=</span> (OneResponse)client.<span style="color: rgb(0, 102, 0); ">execute</span><span style="color: rgb(102, 204, 102); ">(</span> <span style="color: rgb(255, 0, 0); ">"one.vm.allocate"</span>, params <span style="color: rgb(102, 204, 102); ">)</span><span style="color: rgb(102, 204, 102); ">;"</span></span>. </div>
<div>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.</div><div><br></div><div>Best Regards,</div><div>Joey</div><div>
<br><div class="gmail_quote">On Mon, May 2, 2011 at 5:57 PM, Giuseppe Carella <span dir="ltr"><<a href="mailto:cargius@gmail.com">cargius@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi all,<div><br></div><div>I have a problem with XMLRPC API using it with JAVA.</div><div>When I send a request to opennebula XMLRPC server, I receive </div><div>a response like this:</div><div><div><br></div><div>[Ljava.lang.Object;@19968e23</div>
</div><div><br></div><div>How can I extract the vid from this response object?</div><div><br></div><div>I have followed all the instructions in the java example of the web site.</div><div><span style="font-family:Arial, Verdana, Geneva, Helvetica, sans-serif;font-size:13px;line-height:18px"><pre style="padding-top:0.5em;padding-right:0.5em;padding-bottom:0.5em;padding-left:0.5em;border-top-width:1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;border-top-style:dashed;border-right-style:dashed;border-bottom-style:dashed;border-left-style:dashed;border-top-color:rgb(85, 85, 85);border-right-color:rgb(85, 85, 85);border-bottom-color:rgb(85, 85, 85);border-left-color:rgb(85, 85, 85);color:rgb(85, 85, 85);background-color:rgb(245, 245, 245);overflow-x:scroll;overflow-y:scroll;line-height:18px;margin-top:10px;margin-right:10px;margin-bottom:10px;margin-left:10px">
<span style="color:rgb(177, 177, 0)">public</span> <span style="color:rgb(177, 177, 0)">class</span> XmlRpcTest <span style="color:rgb(102, 204, 102)">{</span>
<span style="color:rgb(177, 177, 0)">public</span> <span style="color:rgb(177, 177, 0)">static</span> <span style="color:rgb(153, 51, 51)">void</span> main<span style="color:rgb(102, 204, 102)">(</span> <a href="http://www.google.com/search?hl=en&q=allinurl%3Astring+java.sun.com&btnI=I%27m%20Feeling%20Lucky" style="color:rgb(0, 152, 195);text-decoration:none;font-size:1em" target="_blank"><span style="color:rgb(0, 0, 102)">String</span></a> args<span style="color:rgb(102, 204, 102)">[</span><span style="color:rgb(102, 204, 102)">]</span> <span style="color:rgb(102, 204, 102)">)</span> <span style="color:rgb(177, 177, 0)">throws</span> <a href="http://www.google.com/search?hl=en&q=allinurl%3Aexception+java.sun.com&btnI=I%27m%20Feeling%20Lucky" style="color:rgb(0, 152, 195);text-decoration:none;font-size:1em" target="_blank"><span style="color:rgb(0, 0, 102)">Exception</span></a> <span style="color:rgb(102, 204, 102)">{</span>
XmlRpcClient client <span style="color:rgb(102, 204, 102)">=</span> <span style="color:rgb(177, 177, 0)">new</span> XmlRpcClient<span style="color:rgb(102, 204, 102)">(</span> <span style="color:rgb(255, 0, 0)">"<a href="http://localhost:2633/RPC2" target="_blank">http://localhost:2633/RPC2</a>"</span> <span style="color:rgb(102, 204, 102)">)</span><span style="color:rgb(102, 204, 102)">;</span>
<a href="http://www.google.com/search?hl=en&q=allinurl%3Avector+java.sun.com&btnI=I%27m%20Feeling%20Lucky" style="color:rgb(0, 152, 195);text-decoration:none;font-size:1em" target="_blank"><span style="color:rgb(0, 0, 102)">Vector</span></a> params <span style="color:rgb(102, 204, 102)">=</span> <span style="color:rgb(177, 177, 0)">new</span> <a href="http://www.google.com/search?hl=en&q=allinurl%3Avector+java.sun.com&btnI=I%27m%20Feeling%20Lucky" style="color:rgb(0, 152, 195);text-decoration:none;font-size:1em" target="_blank"><span style="color:rgb(0, 0, 102)">Vector</span></a><span style="color:rgb(102, 204, 102)">(</span><span style="color:rgb(102, 204, 102)">)</span><span style="color:rgb(102, 204, 102)">;</span>
params.<span style="color:rgb(0, 102, 0)">addElement</span><span style="color:rgb(102, 204, 102)">(</span><span style="color:rgb(255, 0, 0)">"SESSION-GOLA&4H910"</span><span style="color:rgb(102, 204, 102)">)</span><span style="color:rgb(102, 204, 102)">;</span>
params.<span style="color:rgb(0, 102, 0)">addElement</span><span style="color:rgb(102, 204, 102)">(</span><span style="color:rgb(255, 0, 0)">"MEMORY=345 CPU=4 DISK=[FILE=<span style="color:rgb(0, 0, 153);font-weight:bold">\"</span>img<span style="color:rgb(0, 0, 153);font-weight:bold">\"</span>,TYPE=cd]"</span>
<span style="color:rgb(255, 0, 0)">"DISK=[FILE=<span style="color:rgb(0, 0, 153);font-weight:bold">\"</span>../f<span style="color:rgb(0, 0, 153);font-weight:bold">\"</span>]"</span><span style="color:rgb(102, 204, 102)">)</span><span style="color:rgb(102, 204, 102)">;</span>
<a href="http://www.google.com/search?hl=en&q=allinurl%3Aobject+java.sun.com&btnI=I%27m%20Feeling%20Lucky" style="color:rgb(0, 152, 195);text-decoration:none;font-size:1em" target="_blank"><span style="color:rgb(0, 0, 102)">Object</span></a> result <span style="color:rgb(102, 204, 102)">=</span> client.<span style="color:rgb(0, 102, 0)">execute</span><span style="color:rgb(102, 204, 102)">(</span> <span style="color:rgb(255, 0, 0)">"one.vm.allocate"</span>, params <span style="color:rgb(102, 204, 102)">)</span><span style="color:rgb(102, 204, 102)">;</span>
<span style="color:rgb(177, 177, 0)">if</span> <span style="color:rgb(102, 204, 102)">(</span> result <span style="color:rgb(102, 204, 102)">!=</span> <span style="color:rgb(0, 0, 0);font-weight:bold">null</span> <span style="color:rgb(102, 204, 102)">)</span>
<a href="http://www.google.com/search?hl=en&q=allinurl%3Asystem+java.sun.com&btnI=I%27m%20Feeling%20Lucky" style="color:rgb(0, 152, 195);text-decoration:none;font-size:1em" target="_blank"><span style="color:rgb(0, 0, 102)">System</span></a>.<span style="color:rgb(0, 102, 0)">out</span>.<span style="color:rgb(0, 102, 0)">println</span><span style="color:rgb(102, 204, 102)">(</span> result.<span style="color:rgb(0, 102, 0)">toString</span><span style="color:rgb(102, 204, 102)">(</span><span style="color:rgb(102, 204, 102)">)</span> <span style="color:rgb(102, 204, 102)">)</span><span style="color:rgb(102, 204, 102)">;</span>
<span style="color:rgb(102, 204, 102)">}</span>
<span style="color:rgb(102, 204, 102)">}</span></pre></span></div><div><br></div><div>Your help is kindly appreciated!</div><div><br></div><div>thanks,</div><div><br></div><font color="#888888"><div>Giuseppe </div>
</font><br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opennebula.org">Users@lists.opennebula.org</a><br>
<a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
<br></blockquote></div><br></div>