[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: <xen-api@xxxxxxxxxxxxxxxxxxx>
  • From: "Aggarwal, Ajay" <Ajay.Aggarwal@xxxxxxxxxxx>
  • Date: Tue, 21 Jul 2009 17:08:56 -0400
  • Delivery-date: Tue, 21 Jul 2009 14:09:02 -0700
  • List-id: Discussion of API issues surrounding Xen <xen-api.lists.xensource.com>
  • Thread-index: AcoKR3VXWgHEpg78TKW7Wwe7+2O5SA==
  • Thread-topic: 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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.