Hi I am having trouble executing a Workflow using the new VCO 5.1 RESTful API. Wondering if you can help.
I am trying to execute a workflow called "HelloAPI", which simply takes one input parameter 'name' which is then outputted to the System.log.
I am getting the error:
The request sent by the client was syntactically incorrect ().
Status Code: 400
When trying to execute the following POST to the API.
curl -k --user vcoadmin:vcoadmin -H "Content-Type:application/xml" -X POST -d request.xml https://<vco-server>:8281/api/workflows/3572df5e-f1ba-4ac4-b7f6-ea3b2cf4bc60/executions/
Request.xml looks like:
I initially had problems due to the Content-Type, but managed to resolve that by sending it in the header. To me, this XML looks how the execution context should according to the API Docs. Any help would be much appreciated.
Thanks
Steve
Hi Steve,
POST-ing to .../workflows/{id}/presentation/instances/ creates a new presentation execution which is useful if you want to validate input parameters. If you are confident that they are valid (as in your example) you don't need to start a presentation execution; you can directly start the workflow execution.
As I said in my previous response, your first attempt was almost correct except the curl command line syntax for specifying request file - it should be
-d @request.xml
Thanks,
Ilian
Have you try to set the request.xml in "" ? I had to call the presentation validation before...
Sent from iPhone | Christian Johannsen | cjohannsen@vmware.com<mailto:cjohannsen@vmware.com> | +49(0)15209359275
Am 13.09.2012 um 17:46 schrieb virtualportal <communities-emailer@vmware.com<mailto:communities-emailer@vmware.com>>:
VMware Communities<http://communities.vmware.com/index.jspa>
Execute Workflow - vCO 5.1 API
created by virtualportal<http://communities.vmware.com/people/virtualportal> in Orchestrator - View the full discussion<http://communities.vmware.com/message/2114079#2114079
Hi Christian,
Just tried it with the request.xml in "" and still no luck..I did notice a typo in my original xml but that didnt solve it either so have updated the original post with the correct xml.
Steve
Here is what works for me:
curl -i -k -H "content-type: text/xml" -u User:Pass --upload-file "in-parameter.xml" -X POSThttps://myVcoServer:8281/api/workflows/9B808080808080808080808080808080C6848080013049428390141bc5149...
Before that I used:
curl -i -k -H "Accept:application/*+xml" -u User:Pass -X GET https://myVcoServer:8281/api/users
best regards
Christian
- The vCO REST API has a documentation that could be access at https://your-vco-ip:8281/api/docs/
I guess you have already done this but just to make sure people reading this thread are aware.
- Next, there is a Java Rest Client and a few examples that could be downloaded from "Files and Libraries": https://your-vco-ip:8281/api/docs/downloads.html
- Also, as Christian said, the recommendation should be to execute workflows via the Workflow Presentation Service since this will provide input validation and collect all error.
- Finally, looking at your xml request, I don't see anything wrong. And by using the Java Rest Client, I was able to execute the same operation.
This is my debug output:
DEBUG headers - >> POST /api/workflows/2ebe44e3-897f-44e5-aeff-f8da104f6ac8/executions/ HTTP/1.1
DEBUG headers - >> Accept: application/json
DEBUG headers - >> Content-Type: application/xml
DEBUG headers - >> Content-Length: 223
DEBUG headers - >> Host: ..........:8281
DEBUG headers - >> Connection: Keep-Alive
DEBUG headers - >> User-Agent: Apache-HttpClient/4.1.2 (java 1.5)
DEBUG headers - >> Authorization: Basic dmNvYWRtaW46dmNvYWRtaW4=
DEBUG wire - >>
"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<execution-context xmlns="http://www.vmware.com/vco">
<parameters>
<parameter name="name" type="string">
<string>TestName</string>
</parameter>
</parameters>
</execution-context>"
DEBUG wire - << "HTTP/1.1 202 Accepted"
DEBUG wire - << "Location: https://.......:8281/api/workflows/2ebe44e3-897f-44e5-aeff-f8da104f6ac8/executions/ff80808139c26a0e0..."
DEBUG wire - << "ETag: "0d41d8cd98f00b204e9800998ecf8427e""
DEBUG wire - << "Content-Length: 0"
DEBUG wire - << "Date: Fri, 14 Sep 2012 03:45:20 GMT"
DEBUG wire - << "Server: vCO Server"
DEBUG wire - << ""
The only thing that I see to be different is that the parameter element doesn't have "description" and "scope" attrubutes. Probably, try removing them (they are optional anyway although not very likely to be the issue).
Also, it is using the default namespace but not sure this could be the issue.
A third option could be with something in the header that you are missing or the way how you create the request. Probably, monitoring the trafic could provide some clue.
Hope this is helpful.
Thanks,
Igor.
Hi Steve,
Your curl command line is not correct. To pass the content of 'request.xml' file as POST body, you need to use the option '-d @request.xml'. Note the extra @ character before file name; without it, the name of the file is passed in the reuest body instead of the file content.
Hope this helps.
Thanks,
Ilian
Hi all,
Maybe I am missing something but changing the URI to /presentation/instances seemed to give me a 200 response However I cannot see any valid workflow runs in the orchestrator client. Is this a change with 5.1?
Here is the response I am getting (request.xml is the same as above):
The only thing I can think of is that this creates a presentation and then I have to run execute? Help much appreciated.
Thanks
Hi Steve,
POST-ing to .../workflows/{id}/presentation/instances/ creates a new presentation execution which is useful if you want to validate input parameters. If you are confident that they are valid (as in your example) you don't need to start a presentation execution; you can directly start the workflow execution.
As I said in my previous response, your first attempt was almost correct except the curl command line syntax for specifying request file - it should be
-d @request.xml
Thanks,
Ilian
Thanks Ilian,
Apologies, I was trying the repsonse which stated I should call /presentation/instances. Looks like it worked once I changed the Syntax of the curl command.
Thanks for your answer
Steve