I'm trying to extend from the excellent information in http://communities.vmware.com/message/2119680 and drive vCO vCD workflows from curl, however I'm again getting the "syntactically incorrect" error return.
Specifically I'm attempting to call the "Power on a vApp" workflow in the vCloud Director library. I'm using the following curl command line:
curl -i - k -H "content-type: text/html" -d @reqbody.xml --user <username>:<password> https://<vCO server>:8281/api/workflows/88808080808080808080808080808080C18080800126658240472157fdafc0fce/executions/
The content of reqbody.xml:
<?xml version="1.0" encoding="UTF-8"?>
<vco:execution-context xmlns:vco="http://www.vmware.com/vco" xmlns="vco">
<vco:parameters>
<vco:parameter name="vApp" type="vCloud:VApp">
<vco:vCloud:VApp>b5cd68fc-a50f-4cac-9b3e-45679bcd2ce7</vco:vCloud:VApp>
</vco:parameter>
</vco:parameters>
</vco:execution-context>
I've also attempted to validate via the presentation and presentation/instances with the same "Bad Request" syntax return. I'm certain I'm somehow mishandling the "vCloud:VApp" type but am at a loss as to how to correct it.
Thanks!
Hi Bill,
There are a few problems:
<vco:parameter name="vApp" type="vCloud:VApp">
<vco:vCloud:VApp>b5cd68fc-a50f-4cac-9b3e-45679bcd2ce7</vco:vCloud:VApp>
</vco:parameter>
it should be something like
<vco:parameter name="vApp" type="vCloud:VApp">
<vco:sdk-object type="vCloud:VApp" id="b5cd68fc-a50f-4cac-9b3e-45679bcd2ce7" />
</vco:parameter>
I don't have vCloud plug-in installed at hand so I haven't tested it, but I expect it to work just fine.
Hope this helps,
Ilian
Why would you use the REST plug-in when you can use the vCloud plug-in ?
Christophe.
I have the vCD plugin in vCO, but I am taking "baby steps" in building a larger workflow which can be driven externally by another automation engine (politics). I'm just working with the vApp power on workflow as a proof of concept for an eventual workflow which might include approvals, deploying a new vApp, CMDB updates, etc etc. Since much of the subject matter is (obviously) new to me I thought starting with a simple workflow and building up would be the best approach.
Thanks!
sneaking in just to clarify a misunderstanding:
I think Bill wants to use the vCO REST API to trigger a workflow from an external system (northbound integration).
I don't have an answer for this specific one, but:
start simpler:
create a hello world workflow with no inputs, and try to call that one.
then: create a hello something workflow that has one string input (or anohter plain data type) and call that one.
then finally try to call a workflow with a complex inventory object as input.
(and keep us updated about the results :smileygrin: )
Cheers,
Joerg
Yep, I noticed that. I replied after reading this from my blackberry and getting confused between the vCD & REST API.
Hi Bill,
There are a few problems:
<vco:parameter name="vApp" type="vCloud:VApp">
<vco:vCloud:VApp>b5cd68fc-a50f-4cac-9b3e-45679bcd2ce7</vco:vCloud:VApp>
</vco:parameter>
it should be something like
<vco:parameter name="vApp" type="vCloud:VApp">
<vco:sdk-object type="vCloud:VApp" id="b5cd68fc-a50f-4cac-9b3e-45679bcd2ce7" />
</vco:parameter>
I don't have vCloud plug-in installed at hand so I haven't tested it, but I expect it to work just fine.
Hope this helps,
Ilian
Thanks for all the good ideas.
I have been able to successfully call the sample "Hello World" from the information in http://communities.vmware.com/message/2119680 via REST using curl. Extending from that I've been able to call "simple" workflows such as "Export Logs and app settings". So I at least know (or think I know) I'm on the right track Its the "x:y" parameter types that have me lost at the moment (I imagine, and will test next, that I'll have similar issues with vCenter workflows for example).
I've modified the curl command line as suggested, and also updated the xml file:
<?xml version="1.0" encoding="UTF-8"?>
<vco:execution-context xmlns:vco="http://www.vmware.com/vco" xmlns="vco">
<vco:parameters>
<vco:parameter name="vApp" type="vCloud:VApp">
<vco:sdk-object type="vCloud:VApp" id="b5cd68fc-a50f-4cac-9b3e-45679bcd2ce7" />
</vco:parameter>
</vco:parameters>
</vco:execution-context>
This causes a slightly different behavior in that now the returned error contains slightly more useful information:
The request sent by the client was syntactically incorrect (1 error(s) found: [ { vApp - This field is required. } ])
I've played a bit with the xml, like including name="vApp" and different vApp ID formats but with no difference in result.
I don't know if this is helpful, but the server.log contains the following information as well:
2012-10-12 11:34:33.682+0000 WARN [TypeQualifierToDecoratorConverter] Can't find mapping for:class ch.dunes.model.type.qualifier.TQCallerParameter,[kind:null,name:contextualParameter,value:]
2012-10-12 11:34:33.682+0000 INFO [Attribute] Cannot convert strong to object dunes://service.dunes.ch/CustomSDKObject?id='b5cd68fc-a50f-4cac-9b3e-45679bcd2ce7'&dunesName='vCloud:VApp'
ch.dunes.model.type.ConvertorException: Cannot convert to object , reason : Unable to perform operation 'find('VApp', 'b5cd68fc-a50f-4cac-9b3e-45679bcd2ce7')' on plugin 'vCloud' reason : 'null'
I have double-checked and can run this workflow directly from the Orchestrator client GUI successfully against the target vApp. So the problem definitely appears to be in my REST request. :smileyconfused:
Actually wandering off into vCenter workflows helped. As well as additional log trolling.
So, the remaining issue was the ID itself, it is much more complex than I thought:
<vco:sdk-object type="vCloud:VApp" id="a8d5ae9e1c4a828c499a6154e392a3016298eed7e4cd3a9abc9da78925////https://_your_vcloud_server_/api/vApp/vapp-b5cd68fc-a50f-4cac-9b3e-45679bcd2ce7" />
I've not yet figured out what the first part of that ID is, and then how to find the whole thing programatically but I'm pretty sure I'll be able to figure this out with more reading/digging.
The XML format was my real stumbling block, though, so I consider my question answered!
Thanks!