Creating a Service for the Execute a Service Action
In the Execute a Service processing action, you can invoke a custom service synchronously, asynchronously, or using a service execution task.
If you invoke the service synchronously or asynchronously, the service must at minimum implement the input variables defined in the wm.tn.rec:ProcessingService specification. The input values are the IS documents (IData objects) that are in the pipeline during processing. The specification does not identify any outputs.
If you invoke the service asynchronously using a service execution task, the service must at minimum implement the input and output variables defined in the wm.tn.rec:ReliableProcessingService specification. The input values are the IS documents (IData objects) that are in the pipeline during processing. The service must provide values for the serviceOutput output variable, which is an IS document (IData object) that contains the String variables listed in the following table:
String Variable | Value |
status | Whether the service: Executed successfully. When the service returns success, Trading Networks updates the status of the service execution task to DONE. Failed. When the service returns fail and the maximum retry limit has been met, Trading Networks updates the status of the service execution task to FAILED. If the maximum retry limit has not been reached, the status of the service execution task remains PENDING and Trading Networks tries to re-execute the service after the wait period elapses. |
statusMessage | Optional. Message that contains more information about the outcome of the service. If the service fails, for example, you should provide an error message that explains the failure. |
transportTime | Optional. Number of milliseconds it took the service to execute. |
If the service requires input values in addition to those in the specification, you might want to hardcode some of the values when you set up the processing rule. For example, you might create a service that can add, update, or delete an entry for a partner in your back-end system. Input to the service is a flag that indicates the action to take. You could create three separate processing rules that all execute this service, but set the input values for the flag differently for each rule. For the rule that adds an entry, set the input value to indicate that the service should add an entry. For the rule that updates an entry, set the input value to indicate the service should update an entry, and so on.