Is there an example of how to invoke an action from within an action?
All the hello world examples use the cli to invoke them. Where do I start when I want to programmatically invoke an action. Do we use the rest API and what would then be the api-host?
If you're using Node.js to implement the functions you can use https://www.npmjs.com/package/openwhisk. The REST API is documented here https://github.com/apache/openwhisk/blob/master/docs/rest_api.md.
In order to invoke ow action from another action, the "parent" action should be created/invoked with annotation provide-api-key == true.
E.g. if invoked using wsk:
wsk action invoke myaction -a provide-api-key true
Then OW populates the parent action with credentials required to communicate with OW.
https://github.com/apache/openwhisk/blob/master/docs/annotations.md#annotations-for-all-actions
Related
I have created an ACTION workflow, and it's synchronous as default, Can I change it to asynchronous and how?
Let me explain the options we have.
You can have a custom Action and that can be invoked from an Asynchronous workflow. Read more
You can register an Asynchronous plugin step to execute on this Custom Action message. Read more
I want to be able to call Dynamics web api action bound to some_entity without a reference to a specific entity record.
I can call the action like:
{{webapiurl}}/some_entity(e922f9f6-03ec-498b-8a3d-0f3fb0fe881b)/Microsoft.Dynamics.CRM.new_someAction7c68ea11a811000d3ab40d73
but I need to be able to call this action before the relevant record saved, so can not use an existing guid.
In that case it has to be an Unbound (Global) custom Action, so you can invoke it the same way as Entity bound action and without record GUID limitation.
No other way to do it.
Is there any way by which controller methods can be used inside Rake task.
You can always call your endpoint but my guess is that you need some logic that lives inside your controller. The best approach would be to extract that logic into some service and use that service in both the controller and your rake task. You get the bonus of being able to test it more easily.
From what I've heard, A controller command can be invoked from within a scriptlet. But I am not sure of other methods. Any code level information would be very helpful.
You can also try making AJAX call from the JSP to the controller command.
You really shouldn't be directly executing a controller command from within the scriptlet code of a JSP. You could use AJAX to call a command service. Or you could use a DataBean Command, though they are really meant to be commands that populate the databean not really call controller commands. You may also be in a situation that you need to review your use of a controller command, possibly BOD commands would be a better fit if you are wanting to invoke a service from the JSP during the page generation.
You could create your own mapping of your ControllerCommand to REST.
http://www-01.ibm.com/support/knowledgecenter/SSZLC2_7.0.0/com.ibm.commerce.webservices.doc/tasks/twvrestsamplecmd.htm
Then you use the REST tag to run the ControllerCommand.
http://www-01.ibm.com/support/knowledgecenter/SSZLC2_7.0.0/com.ibm.commerce.component-services.doc/refs/rwvwcfresttag.htm
In the new implementation from IBM in FEP8 this will be done locally if possible and will therefor not add any extra network overhead.
By Using Databean also we can invoke controller commands.
ex : <wcbase:usebean>
My app is using OpenURI's open() method, to fetch a web page.
In my spec I want to be able to replace the URL passed in open to the path of a local file.
So when calling open('http://www.google.com') I want to switch that url to /path/to/file.
Is there a build-in way to do this in RSpec?
I do not think rspec provide anything to achieve this. You're better off adding a parameter to the method that invokes open() in your application. This will make the code reusable.
If the application code cannot be modified, you could try to overwrite the open() method to substitute the parameter in your rspec script.
If you are planning to write tests against remote URLs, I'd suggest taking a look at the following:
WebMock: https://github.com/bblimke/webmock
VCR: https://github.com/myronmarston/vcr