VMware Cloud Community
admin
Immortal
Immortal

vCO HTTP REST Plugin: Error while running workflow "Invoke REST operation" on operation under parent host

Hi,

I added REST Host "RHOST1" in inventory (alongwith Basic Auth: Username and passsword)

I added GET operation "OP1" in inventory under "RHOST1" as parent host

When I do "invoke REST operation" on "OP1", presentation tab only shows one input param  "REST operation to be used for call"

When workflow is run I get error "Authorzation header not present".

I have already added credentials to parent host "RHOST1". Do I again need to provide these details while invoking REST operation "OP1" under parent host.

If yes, how I can provide "authorization header" while doing "Invoke REST operation"(I can see 15 params in Action Input tab but cant see in presenation tab while running workflow)

Regards

Sameer

0 Kudos
2 Replies
aleksandarp
VMware Employee
VMware Employee

Hi Sameer,

You don't need to enter authentication for an operation since it is inherit from the REST host. The user name and password that you've entered when registering the host will be used when you invoke the child operations.

If the server that you are trying to access is public you could send it to us to see if we could identify what might be the problem with the authentication header. Other thing that you might do is to place an HTTP proxy between the vCO and your server to see the exact HTTP requests and if all headers are presented as required.

Best regards,

Aleksandar

0 Kudos
igorstoyanov
VMware Employee
VMware Employee

Very late response to this but I was just able to reproduce the same issue with Basic Auth using vShield REST API.

I believe that in cases like those the server is not returning the correct header to notify that expects Basic authentication because usually when there is a Basic Authentication, the browser will popup a login form. It doesn't do it for the vShield APIs but on the other side it works from Firefox REST plugin. So, I believe that this issue would be fixed in a future update release of the plugin.
Meanwhile, there is a bit of multi-steps workaround:
1. Set JavaScript Access to Java Classes
Basically the steps to do what is written in the documentation are (describing the steps for vCO Appliance but should be similar for Windows)
- Go to Appliance Home Page and navigate to Appliance Configuration link
- Navigate to the tab "Admin" and click on the "Toggle SSH settings" button.
The indicator "Administrator SSH login enabled" should change to "Yes"
1.2 Create a java shutter file
- Connect via SSH to the appliance (again username/password root/vmware).
- Navigate to: /opt/vmo/app-server/server/vmo/conf/
- create  a file with name "java_shutter_file" (the name doesn't matter but will be referenced in the property file)
- the file should contain the following two lines (new lines, no empty spaces):
org.apache.commons.codec.binary.Base64
java.lang.String
- edit the vmo.properties in the same folder and append the following line at the end:
com.vmware.scripting.rhino-class-shutter-file=/opt/vmo/app-server/server/vmo/conf/java_shutter_file
1.3 Restart vCO Server from vCO Configurator
- Appliance Home page/Configuration/Startup Options
The steps up to here will allow for the two java classes defined above to be used directly in the javascript.
2. Import the packaged attached.
There are two workflows that duplicate the library ones:
- Invoke a vShield REST Host - invoke a REST call directly on a host
- Invoke a vShield REST operation - invoke an already defined rest operation for a host
NOTE: The name is vShield but they are just general ones that fix that issue.
So, instead of using the library ones those two should be used.
The host should be created wiht :
- url in form of: https//server-ip/....
- Authorization - Basic
- Shared Session
- username/password.
Once the host is created, you can either invoke directly a rest call with "Invoke a vShield REST Host" workflow
Or an operations could be defined for this host and the second workflow could be called on a operation.
Hope, this will be helpful for somebody that encounters the same issue.
Thanks.
Visit http://blogs.vmware.com/orchestrator for the latest in Cloud Orchestration.
0 Kudos