Home > vSphere API > Announcing Code Generator For vSphere Java API

Announcing Code Generator For vSphere Java API

February 1st, 2012 Leave a comment Go to comments

As I tweeted last week, there would be a big announcement when the open source VI Java API gets 20,000 downloads. It hit target yesterday. To celebrate it, I decide to release the code generator for the API, which William (@lamw) rated as “awesome.”

If you have used Onyx for generating PowerCLI code before, you can think it as Java version of Onyx. Even better, it generates complete Java code which is ready to run once you supply the URL, username, and password. It’s so easy that from now on, all the system administrators have no excuse for not trying open source vSphere Java API. :-)

Time to learn how to "Google" and manage your VMware and clouds in a fast and secure


At its heart, the code generator is a reversed proxy which sits between a vSphere Client and vCenter or ESX(i) server, and intercepts the SOAP XML messages. With the XML messages, I designed the algorithm to automatically generate the Java code based on the open source Java API code.

Unlike Onyx, the Java code generator provides richer GUI which allows you to:

  • Record both the requests and responses.
  • Sort the recorded messages in any order.
  • Generate complete code of any selected requests.
  • Save recorded messages to a local file, and read it back later.
  • Support raw HTTP data, XML, Java simultaneously in different tabs.

Although the generator supports only Java today, I did designed it to be extensible architecture for other languages like Jython, JRuby, Perl, etc. When I have time, I will continue to work on these in the future.

Too much talk? Let’s take a peek at a few screenshots in this page which includes download link and getting started tutorial. Shorter than my 5 minute VI Java API tutorial, it should be less than one minute this time.

Hope you enjoy the tool and let me how you like it.

  1. February 1st, 2012 at 07:31 | #1

    This does sound “Awesome”. I can’t wait to try it out.

  2. monsrud
    February 8th, 2012 at 14:50 | #2

    Thanks. This will be extremely helpful.

  3. Abe
    February 25th, 2012 at 07:55 | #3

    Can this tool be used to emulate a Virtual Center? We have a need for such a tool that can simulate 1000+ VMs.


  4. February 26th, 2012 at 16:11 | #4

    It cannot emulate a vCenter as it is. What’s the purpose for the emulation?

  5. Louis Jia
    April 23rd, 2012 at 15:24 | #5

    What is URL to download this powerful tool?

  6. April 23rd, 2012 at 15:39 | #6

    Check out in this page: http://www.doublecloud.org/doublecloud-proxy/

  7. Michael Landman
    May 25th, 2012 at 08:08 | #7

    Hi Steve,

    I’m looking to automate the deployment of a virtual appliance from template, which I currently accomplish through the interactive dialog vSphere presents. I’ve used vijava in the past to automate the restoration of snapshots and other activities… do you know if I’ll be able to capture the correct set of messages to translate to java using this tool, to deploy appliances?

    Thanks in advance,


  8. May 25th, 2012 at 15:21 | #8

    Hi Mike,
    Whatever you can do from vSphere Client should be recorded and code generated. You may need to tweak the code a bit afterwards.

  9. tangramor
    July 27th, 2012 at 02:57 | #9

    tried this tool, it only works with Sun (now Oracle) JDK, failed on IBM JDK.

    It really works, however, I do want to have a tailor function or filter funtion to remove the useless messages

  10. Mike Landman
    February 6th, 2013 at 14:27 | #10

    This was very useful when debugging why my usage of cloneVM via vijava APIs were failing, but the clone was succeeding via vSphere client. I was able to see vSphere client populating additional values for the cluster resourcePool that I didn’t know were required.

    I tried to use it side by side with the java APIs, by specifying the proxy at service instance creation time. :) It worked, but for the traffic generated by vijava, the SOAP operation shows as “?xml”. I can a bunch of the XML, but it does not format nicely and is very difficult to read, in comparison to the traffic captured from vSphere. Is there a way that vijava can generate the appropriate headers so that the soap messages are read and displayed in a more readable fashion?

  11. March 19th, 2013 at 10:14 | #11

    The generated code has some error and it looks like I am not pointing to the right library.
    I am using vijava5120121125.jar which contains HostNetworkSystem class but the generated code invokes a constructor without arguments while the code is expecting a ServerConnection argument. In addition the next line of code
    _type1.type = “HostNetworkSystem”;
    is also in error because no type field exist.

    Could you, please, help with this?
    THank you

  12. March 22nd, 2013 at 10:45 | #12

    Thanks for reporting the issue. I will look into it later.

  1. No trackbacks yet.