Skip to content

SOAP web services

Most new APIs are REST (recipe 5.2), but plenty of older systems still speak SOAP: ticket tools, IP address managers, storage arrays, and vCenter itself, whose vSphere API is a SOAP API underneath. Orchestrator’s SOAP plug-in reads a service’s WSDL, the XML file that describes its operations, and turns every operation into an object you can call.

This recipe uses vCenter’s SOAP API as the example, because every VCF lab has one and one of its operations needs no login.

Getting ready

  • A vCenter, here vc01.vmw.lab, whose certificate Orchestrator already trusts (recipe 1.9). The SOAP plug-in uses the same trust store.
  • The module com.vcfguide.chapter5.

How to do it

Add the SOAP host

  1. In Library > Workflows, run Add a SOAP host (folder Library > SOAP > Configuration) with:

    Field Value
    Name vc01-soap
    Provide WSDL content No
    WSDL URI https://vc01.vmw.lab/sdk/vimService.wsdl
    Connection timeout (in seconds) 30
    Request timeout (in seconds) 60
    Authentication type None

    On the Host authentication page, leave Authentication type at None. Orchestrator downloads the WSDL and the files it imports, and builds an operation for each SOAP call; for the vSphere API the run took about ten seconds.

  2. A WSDL says where its service lives, and vCenter’s says https://localhost/sdk, which from Orchestrator is the wrong machine. Run Update a SOAP host with an endpoint URL on vc01-soap with https://vc01.vmw.lab/sdk. From now on, calls go there instead of to the address in the WSDL.

Figure 5.23. The SOAP host in the inventory, with one operation and its parameters.

Call an operation from a script

  1. Each operation lists its inputs and outputs as flat names: nested elements are joined with dots, and an XML attribute appears with its name in brackets. RetrieveServiceContent has the inputs _this and _this(type), and outputs such as returnval.about.fullName. Create the action getSoapServiceInfo in com.vcfguide.chapter5, with the input host (SOAP:Host) and the return type Properties:
com.vcfguide.chapter5/getSoapServiceInfo
if (!host) {
throw "[VCFG][getSoapServiceInfo] host is required";
}
var operation = host.getOperation("RetrieveServiceContent");
if (!operation) {
throw "[VCFG][getSoapServiceInfo] " + host.name + " has no operation RetrieveServiceContent";
}
// The operation's inputs, as listed by operation.getInParameters(): _this and _this(type)
var request = operation.createSOAPRequest();
request.setInParameter("_this", "ServiceInstance");
request.addInParameterAttribute("_this", "type", "ServiceInstance");
var response = operation.invoke(request);
var info = new Properties();
info.put("fullName", response.getOutParameter("returnval.about.fullName"));
info.put("version", response.getOutParameter("returnval.about.version"));
info.put("build", response.getOutParameter("returnval.about.build"));
info.put("apiVersion", response.getOutParameter("returnval.about.apiVersion"));
System.log("[VCFG][getSoapServiceInfo] " + host.name + ": " + info.get("fullName"));
return info;
  1. Run it with vc01-soap. It returns the vCenter’s product name, version, build and API version, such as VMware vCenter Server 9.1.1.0.25712839.

Without code

  1. The folder Library > SOAP has two workflows for calls without code. Invoke a SOAP operation takes an operation and up to 15 parameters and 5 headers as text, in the order the operation lists them, and returns the response’s parameters and headers as Properties. Generate a new workflow from a SOAP operation writes a workflow for one operation, which you can then edit like any other.
Checked on an embedded Orchestrator 9.1.1, inside VCF Automation, 1 Dec 2026. Calls to vCenter’s SOAP host failed with Exception while calling operation [RetrieveServiceContent]: null until the endpoint URL was set in step 2. In Add a SOAP host, the input behind Provide WSDL content is isWsdlLocal: true means “use the WSDL text I paste”, not “download it”, despite its description. The certificate of a vCenter already added to the vSphere plug-in was accepted without a prompt.

How it works

The WSDL is the contract. It lists every operation, the XML each one takes and returns, and the service’s address. The SOAP plug-in parses it once, when you add the host, and stores the result, so your scripts work with names rather than raw XML. If the service changes its WSDL, run Update a SOAP host to read it again.

Flat names for nested XML. SOAP messages are trees. The plug-in flattens them: returnval.about.version is the version element inside about inside returnval, and _this(type) is the type attribute of _this. getInParameters() and getOutParameters() on an operation list the names it expects, so print them first when you write a call to a new service.

When to use the vSphere plug-in instead. This recipe calls vCenter through SOAP only because it’s a SOAP service everyone has. For real vCenter work, use the vSphere plug-in (recipe 8.1): it logs in for you, keeps a session, and gives you typed objects instead of strings. Use the SOAP plug-in for systems that have no plug-in of their own.

Logging in. Most services need credentials. Add a SOAP host offers Basic, Digest and Negotiate (Kerberos, with the service’s SPN), with a Shared Session (one account for everyone) or a Per User Session (the credentials of whoever runs the workflow), as the REST plug-in does (recipe 5.2). Some services want a login operation first and a token in a header on every later call; set it with request.setInHeader() or request.setHttpHeader().

Back in vRO 5.5–7The Cookbook added SOAP hosts from the Java client and called operations with generated workflows, for vCloud Director and other SOAP-era products.
In Orchestrator 9.xThe same plug-in and workflows ship with Orchestrator 9.x. SOAP is now mostly found in older enterprise systems; prefer a REST API where the system has one.

See also