A WebService-Client for vCO: Running the samples

VMware vCenter Orchestrator provides a SOAP-based Web-Service API, which you can use to start and monitor workflows from an external System. (This can also be used to create a webbased Client for vCO with something else than Webviews, see a detailed discussion here)

For a quick-start VMware provides a fully-functional Java-based Example-Client in the vco-samples.zip. In this post You will see how to build and run these examples.

You need:

  • A working Orchestrator Server
  • The Java Development Kit installed on Your Desktop
  • Ant
  • The vco-samples.zip, downloadable from the vCO-Documentation-Homepage

Prepare:

1. Download and install Ant (Don’t forget to set the environment variables JAVA_HOME, ANT_HOME and add the \bin-directories to your PATH!)

2. Download and unzip the vco-samples package.

3. Open a console, change to the webservice-example directory and run ant.

Use ant to build the examples

4. Edit the samples.properties-File and insert the connection details to Your vCO-Server:

5. Now you can run the Inventory.bat to check if the Sample-client can access the vCO-Server as expected (You sould see an “Ascii-Art – Representation of Your vCO’s Inventory):

(If something goes wrong here, it might be hard to read the error-messages. Double-check your connection-settings (including correct username/password) in the sample.properties!)

6. Most of the other samples in this Client access (hard-coded) Workflows. So you have to import the bundled Package to your vCO-Server: Open the vCO-Client, click on the small drop-down-Menu of the Packages-section, select “Import package…“, and import the com.vmware.samples.webservice.package from the WebServiceSample-Directory:

You should see a couple of new Workflows beeing added to your Workflow-Library:

7. Now you can run the other .bat-Files to Run a Workflow for instance (watch the vCO-client: You should see the new WorkflowToken appear!):

8. In the Example-client (built to samples.jar in step 3.) there are more calls, not all of them are a directly runable via a .bat-File. So for Your convenience you can copy the Inventory.bat to e.g. Samples.bat, and edit & replace the com.vmware.client.Inventory to com.vmware.client.%1 at the end of the (single) line. This allows you to call the other examples via the .bat instead of a long call with all the classpath-String.

To test, run Samples.bat FindAllByType (which should give you a list with all the VC:VirtualMachines in your Inventory):

A complete List with all examples:

  • FindAllByType
  • GetWorkflowEcho (broken, because of an hardcoded VC4:VirtualMachineGuestOsIdentifier … (you see: the examples-package contains some outdated stuff šŸ˜›Ā  )
  • GetWorkflowOutput
  • Inventory
  • LaunchWorkflow
  • LaunchWorkflowWithInput

10. Now You can start examine, how the things work (or why not :mrgreen:Ā  ) by digging into the sourcecode of the examples, which can be found in src/com/vmware/client:

Have fun! šŸ˜Ž