Thursday, May 19, 2011

PHP - how to establish a vCO webservice client

Discussing about the vCO webservice clients with Jason Miles at the PSO training I decide to show up how simple it is to build a webservice portal. With this you can easily establish web integration if the customer already has a web portal, for example.

The PHP script has two components (.inc and .php):
  • parameters.inc
  • findWorkflows.php
  • findWorkflowsWithName.php
The first file holds the vCO servername/ip address, the username and the password, the second is the actual script. With "findWorkflowsWithName.php" I want to show how easy the parameter handover from a HTML form is.

At first I create the "parameters.inc" to change the credentials in a central way.



 












After including the right credentials for the vCO connection I create the findWorkflows.php:
















After saving the work the test in the browser shows up all workflows of my vCenter Orchestrator Server.















So the first example is done. The connect works and the first method: "getAllWorkflows" from the vCenter Orchestrator WSDL is running. But in most cases customers want to give data from an external website to the vCenter Orchestrator. I show this with the "getWorflowsWithName" method in another script (findWorkflowsWithName.php).
















With this the user can search for a workflow by name.
















So, get your feet on the street and start building you own web portal :-)

WARNING - when developing this I found out that the input parameter for "getWorkflowsWithName" isn´t only "name", it is "workflowName"! - WARNING









So, sometimes there are some little traps but we try to fix that!

2 comments:

  1. Can you show how to start a workflow with php?
    I stuck with the inParameter f.e. at the "Create a virual Machinefolder"-Workflow.

    ReplyDelete
  2. I tried the executeWorkflow and it works, i think, but i cannot pass the input attributes, any ideas on how that is done?

    ReplyDelete