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.
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 Ā ) by digging into the sourcecode of the examples, which can be found in src/com/vmware/client:
Have fun! š
is it possible to launch a existing library workflow via sample provided by you??????
My example calls the WebService-Client-Example from the .zip-file. There the workflow name is hardcoded (line 21 in $ZIPFOLDER$WebServiceWebServiceSamplesrccomvmwareclientLaunchWorkflow.java ). If you want to call a library workflow, just edit the file, recompile and you should be ready to go.
Hi Joerg.. actually i am new to VCO. I tried your sample and imported this package but the VMware plug in which is used is of older version, Therefore m not able to complete the above steps..where can i get new version of Vmware plugin which can be used in your webservice sample.
Hi, the SOAP API that is mentioned in this article has been deprecated and should not be used anymore.
Check out the new REST API, find some examples here: http://www.vcoteam.info/articles/learn-vco/268-how-to-use-the-rest-api-to-start-a-workflow.html and the video here: https://www.youtube.com/watch?v=14WeRVv3NDo
Thanks Joerg will try the above links. can you please clear one more doubt of mine? I am always getting permission denied error while creating a file/directory or reading/writing in VCO. ” Permission denied on file ‘C:Windowssystem32configsystemprofileAppDataLocalTempC:anu
eadme.txt’ , write not allowed”
Check that js-io-rights.conf is configured properly on the vRO server, and that the user account the vRO service runs with has the proper rights to write that file/folder on filesystem permission level.
thank you Joerg it worked. I am trying to create a workflow to create a disk alert whenever diskusage reaches its threshold value. i tried it doing by powershell scripting but couldnot complete it. some script error. Can you please suggest some easy trick to do this