One approach to targeting multiple versions of the API from the same client application code is to check for the existence of the server versions file on the server. If you do not find a vimServiceVersions.xml file on the server, the server is older than ESX/ESXi 4.x, vCenter Server 4.x.