Re: [one-users] RPCXML response problem

2011-05-03 Thread Carlos Martín Sánchez
Hi all,

For questions about the Apache XML-RPC library, please visit their site.
http://ws.apache.org/xmlrpc/

Regards.
--
Carlos Martín, MSc
Project Major Contributor
OpenNebula - The Open Source Toolkit for Cloud Computing
www.OpenNebula.org  | cmar...@opennebula.org


On Mon, May 2, 2011 at 5:10 PM, Joey  wrote:

>  Hi,
>
> You can use the xmlrpc jars in the opennebula source code, which are
> located at ./src/oca/java/lib/.
>
> There are three jars: *ws-commons-util-1.0.2.jar*, *
> xmlrpc-client-3.1.2.jar* and *xmlrpc-common-3.1.2.jar*. Just add these
> three jars in to the classpath of the project in netbeans, and it is enough
> for compiling the java oca source codes.
>
> Best Regards,
> Joey
>
>
>
> On 2011/5/2 22:48, Marco Mirabile wrote:
>
> ciao
> I can not add the xmlrpc libraries in NetBeans.
> I downloaded the jar using the website www.findjar.com
> I can get some help?
> After I add the package in NetBeans, what can I do?
>
> marco mirabile
> ___
> Users mailing 
> listUsers@lists.opennebula.orghttp://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
>
>
> ___
> Users mailing list
> Users@lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
>
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] RPCXML response problem

2011-05-02 Thread Joey

Hi,

You can use the xmlrpc jars in the opennebula source code, which are 
located at ./src/oca/java/lib/.


There are three jars: *ws-commons-util-1.0.2.jar*, 
*xmlrpc-client-3.1.2.jar* and *xmlrpc-common-3.1.2.jar*. Just add these 
three jars in to the classpath of the project in netbeans, and it is 
enough for compiling the java oca source codes.


Best Regards,
Joey


On 2011/5/2 22:48, Marco Mirabile wrote:

ciao
I can not add the xmlrpc libraries in NetBeans.
I downloaded the jar using the website www.findjar.com
I can get some help?
After I add the package in NetBeans, what can I do?

marco mirabile
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] RPCXML response problem

2011-05-02 Thread Marco Mirabile
ciao
I can not add the xmlrpc libraries in NetBeans.
I downloaded the jar using the website www.findjar.com
I can get some help?
After I add the package in NetBeans, what can I do?

marco mirabile
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] RPCXML response problem

2011-05-02 Thread Joey

Hi,

I refer to the ./src/oca/java/org/opennebula/client/Client.java. Its 
"call" method is defind as:


public OneResponse call(String action, Object...args)
{
boolean success = false;
String  msg = null;

try
{
Object[] params = new Object[args.length + 1];

params[0] = oneAuth;

for(int i=0; i 1)
{
try
{
msg = (String) result[1];
}
catch (ClassCastException e)
{
// The result may be an Integer
*msg = ((Integer) result[1]).toString();*
}
}


}
catch (XmlRpcException e)
{
msg = e.getMessage();
}

return new OneResponse(success, msg);
}

You're right. Apologize for my incorrect advice. :-P

On 2011/5/2 18:34, Giuseppe Carella wrote:

It works!

in the web site example there is not this cast:

Object untypedResult=null;
try {
untypedResult = client.execute( "one.vmpool.info 
", params );

} catch (XmlRpcException e) {
e.printStackTrace();
}
Object[] result = (Object[]) untypedResult;
Thank you Joey,

Best,

Giuseppe

2011/5/2 Joey Ma mailto:majunj...@gmail.com>>

Hi,

Maybe you should cast the returned type of Object to the
OneResponse, "OneResponse 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
mailto:carg...@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  

  args[]  )  throws  Exception  

  {
 XmlRpcClient client=  new  XmlRpcClient(  
"http://localhost:2633/RPC2";  );
 Vector  

  params=  new  Vector  
();
 params.addElement("SESSION-GOLA&4H910");
 params.addElement("MEMORY=345 CPU=4 
DISK=[FILE=\"img\",TYPE=cd]"
"DISK=[FILE=\"../f\"]");

 Object  

  result=  client.execute(  "one.vm.allocate", params);

 if  (  result!=  null  )
 System  
.out.println(
  result.toString()  );
 }
}


Your help is kindly appreciated!

thanks,

Giuseppe

___
Users mailing list
Users@lists.opennebula.org 
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org





___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] RPCXML response problem

2011-05-02 Thread Giuseppe Carella
It works!

in the web site example there is not this cast:

Object untypedResult=null;
try {
untypedResult = client.execute( "one.vmpool.info", params );
} catch (XmlRpcException e) {
e.printStackTrace();
}
 Object[] result = (Object[]) untypedResult;

Thank you Joey,

Best,

Giuseppe

2011/5/2 Joey Ma 

> 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 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 
>> 
>>  args[] ) throws Exception 
>> 
>>  {
>> XmlRpcClient client = new XmlRpcClient( "http://localhost:2633/RPC2"; 
>> );
>> Vector 
>> 
>>  params = new Vector 
>> ();
>> params.addElement("SESSION-GOLA&4H910");
>> params.addElement("MEMORY=345 CPU=4 
>> DISK=[FILE=\"img\",TYPE=cd]""DISK=[FILE=\"../f\"]");
>>
>> Object 
>> 
>>  result = client.execute( "one.vm.allocate", params );
>>
>> if ( result != null )
>> System 
>> .out.println(
>>  result.toString() );
>> }}
>>
>>
>> Your help is kindly appreciated!
>>
>> thanks,
>>
>> Giuseppe
>>
>> ___
>> Users mailing list
>> Users@lists.opennebula.org
>> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>>
>>
>
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] RPCXML response problem

2011-05-02 Thread Joey Ma
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  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 
> 
>  args[] ) throws Exception 
> 
>  {
> XmlRpcClient client = new XmlRpcClient( "http://localhost:2633/RPC2"; 
> );
> Vector 
> 
>  params = new Vector 
> ();
> params.addElement("SESSION-GOLA&4H910");
> params.addElement("MEMORY=345 CPU=4 
> DISK=[FILE=\"img\",TYPE=cd]""DISK=[FILE=\"../f\"]");
>
> Object 
> 
>  result = client.execute( "one.vm.allocate", params );
>
> if ( result != null )
> System 
> .out.println(
>  result.toString() );
> }}
>
>
> Your help is kindly appreciated!
>
> thanks,
>
> Giuseppe
>
> ___
> Users mailing list
> Users@lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
>
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


[one-users] RPCXML response problem

2011-05-02 Thread Giuseppe Carella
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

args[] ) throws Exception

{
XmlRpcClient client = new XmlRpcClient( "http://localhost:2633/RPC2"; );
Vector 

params = new Vector
();
params.addElement("SESSION-GOLA&4H910");
params.addElement("MEMORY=345 CPU=4
DISK=[FILE=\"img\",TYPE=cd]""DISK=[FILE=\"../f\"]");

Object 

result = client.execute( "one.vm.allocate", params );

if ( result != null )
System
.out.println(
result.toString() );
}}


Your help is kindly appreciated!

thanks,

Giuseppe
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org