Home | Printable Version
1.2.11: Invoke Service
The Invoke Service action calls a specified service, typically another controller, and updates the FactBase with the response XML. The first parameter (from location) indicates the xml content to send as the request to the service, and the second parameter (to location) indicates the location in the FactBase to insert the response. Both of these require XPaths. The Invoke Service action also supports the Merge Option setting to determine how the returned XML will be inserted. Screen-shot of an initial invoke service action The remaining parameters are used to specify the target for the service call. When you initially add the action, you will see a number of links to set the type of service call you wish to make. When you click one of these links you can use the Select Target Service popup to pick which service to call, or to set up a new one if required. Once set, the action display will adjust to show the details of the selected target service. The Change link can be used to display the Select Target Service popup again to enable a different service to be selected. The Service Call Type dropdown can be changed if you wish to call one of the other types of service. When applicable (eg if using Call Another Controller), the View Target Rules link will be displayed to allow you to easily see the Rules that will be processed in the target service being called. Screen-shot of a call controller invoke service action For more advanced scenarios, the Configure a Generic Service Call type can be use, which allows both the Target Service and Action values to be typed in manually. If taking this approach, it is important to ensure the the Target Service contains the full 4 part ID of the agent being called. When making external calls, the target specified here will actually be the Proxy for the remote service. You can then configure the runtime location of the service by using the Test Settings or Publish Settings dialogs as appropriate. Screen-shot of an example generic invoke service action
Parallel Processing
The Invoke Service action also has the ability to perform a non-blocking service call. This starts the service call on a different thread, enabling the rest of this rule, and other rules to continue execution. Once all the rules have been processed, this controller will wait for any parallel calls to also complete, before returning a response. If you need to perform some functionality when the response from a parallel call has been retrieved, you should add an additional rule that has a condition check looking for this response structure in the FactBase. We recommend enabling Forward Chaining to ensure this functions correctly. This parallel capability is often useful when you are making multiple calls to third party services. For example, if you are calling two independent web services from a single controller, you could run these both in parallel, and potentially reduce the overall execution time for the controller. To activate this feature simply click the Run this Action in Parallel? tick box.
Insert REST Header Java Method