Never mind. Got the answer in the API specs. Should have looked there first...
"ints are all assumed to be 64-bit in our API and are encoded as a string of decimal digits (rather than using XML-RPC's built-in 32-bit i4 type)." From: [email protected] [mailto:[email protected]] On Behalf Of Aggarwal, Ajay Sent: Tuesday, July 21, 2009 5:09 PM To: [email protected] Subject: [Xen-API] how does Citrix implement API fields of type 'int' I am trying to implement Xen API (server side) and test it using Citrix Java Bindings (version 5.5). I have a question regarding API fields of type 'int' such as host.API_version_minor and host.API_version_major. Using Citrix Java Bindings when I request host.get_API_version_major, I think my server response comes back ok, but the SDK Java client is not able to parse it. Below is the XML request/response. Request using Citrix Java client : <methodCall> <methodName>host.get_API_version_major </methodName> <params> <param> <value>trjp19gne05edqnajbgmpc6me5</value> </param> <param> <value>host:023</value> </param> </params> </methodCall> My server's response: <methodResponse> <params> <param> <value> <struct> <member> <name>Status</name> <value>Success</value> </member> <member> <name>Value</name> <value> <i4>1</i4> </value> </member> </struct> </value> </param> </params> </methodResponse> But Citrix Java client is not able to parse this response. I get the error [java] java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String [java] at com.xensource.xenapi.Types.toLong(Types.java:6559) [java] at com.xensource.xenapi.Host.getAPIVersionMajor(Host.java:477) [java] at com.xensource.xenapi.Connection.setAPIVersion(Connection.java:368) [java] at com.xensource.xenapi.Connection.dispatch(Connection.java:308) [java] at com.xensource.xenapi.Session.loginWithPassword(Session.java:438) [java] at TestBase.connect(TestBase.java:52) [java] at VIFTest.RunTest(VIFTest.java:30) [java] at RunTests.main(RunTests.java:114) Also looking at the SDK Java client code, it treats these 'int' fields as Long. Interestingly if I implement those 'int' type fields as String in my server, then the SDK Java client is happy. However that's not the correct implementation for fields of type 'int'. Any help would be much appreciated. -Ajay
_______________________________________________ xen-api mailing list [email protected] http://lists.xensource.com/mailman/listinfo/xen-api
