WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-api

RE: [Xen-API] how does Citrix implement API fields of type 'int'

To: <xen-api@xxxxxxxxxxxxxxxxxxx>
Subject: RE: [Xen-API] how does Citrix implement API fields of type 'int'
From: "Aggarwal, Ajay" <Ajay.Aggarwal@xxxxxxxxxxx>
Date: Tue, 21 Jul 2009 17:24:20 -0400
Delivery-date: Tue, 21 Jul 2009 14:24:26 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <EEEB1FA7BB798343BD171137F3E7FA53041873CE@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-api-request@lists.xensource.com?subject=help>
List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
List-post: <mailto:xen-api@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-api>, <mailto:xen-api-request@lists.xensource.com?subject=unsubscribe>
References: <EEEB1FA7BB798343BD171137F3E7FA53041873CE@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-api-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcoKR3VXWgHEpg78TKW7Wwe7+2O5SAAAfMuA
Thread-topic: [Xen-API] how does Citrix implement API fields of type 'int'

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: xen-api-bounces@xxxxxxxxxxxxxxxxxxx [mailto:xen-api-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Aggarwal, Ajay
Sent: Tuesday, July 21, 2009 5:09 PM
To: xen-api@xxxxxxxxxxxxxxxxxxx
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
xen-api@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/mailman/listinfo/xen-api
<Prev in Thread] Current Thread [Next in Thread>