zato service invoke

Overview

Invokes a service by its name. Any service can be invoked. The service does not need to be a REST one and there is not need to create a REST channel for the service before it can be invoked.

To send JSON or any other type of data, use the --payload option, e.g. --payload '{"client_id": 123}'.

If a service produces no response, '(None)' will be returned.

If using the --is-async flag, the service will be invoked asynchronously, in background, and on response the invocation's CID (correlation ID) will be returned rather than the actual response from the service. This is useful if the service should trigger a very long running process that is not expected to not respond swiftly.

If the service expects HTTP headers, use the --headers option to pass them, e.g. "--headers x-my-header1=myvalue1; x-my-header2=myvalue2".

Usage examples

$ zato service invoke /opt/zato/server1/ zato.ping
{'pong': 'zato'}
$
$ zato service invoke /opt/zato/server1/ my.service --payload '{"client_id": 123}'
{'client_name': 'hello'}
$
$ zato service invoke /opt/zato/server1/ zato.ping --is-async
33c77048f51c781abc60e40b
$