a
Setting composite Service Functions
A composite Service Function allows to invoke multiple Service Functions from a single ACTSERVER call. It aggregates return XML from all invoked Services and returns final XML to the caller. Services in a COMPOSITE Service are normally invoked sequentially, but you can configure them to be invoked in parallel to improve performance. Within a COMPOSITE Service, you can also configure a service to take XML result from another service.
From the Application Manager either:
Right-click the Services node in the Application Explorer and select New COMPOSITE service menu item,
Click on the Edit menu bar item and select New COMPOSITE service
A new service is added to the Services node with the default name of COMPOSITE SERVICEn. The Edit Composite Service window will open.

In the Edit Composite Service window right-click on the Service node to add different actions to the composite service. Choose one of the following action:
Add Sequential service: to add services that are executed sequentially.
Add Parallel service group: to add services inside the group that are executed in parallel (different threads).
Add Data mapping group: to add map data to static text, properties or XPath to XML data.
Add XML data: to add XML data to the current XML data structure.

Once you have added different action, you can select Test tab to run your composite service. If any service references to property, you will be able to specify a test value for those properties. Once you set a test value, click Test Service button to test the service. You can view the resultant data and create datakeys from the test result window.
The Request tab contains a tree of actions to be executed for a Composite Service Function. All actions are executed sequentially from the top to the bottom.
In the XML data field you can specify a static XML data block to be merged to the current XML data.
In the Add XML to (XPath) field enter the location where the XML data block is merged. By default the XML data block is appended to the end of current XML data. If XPath cannot be resolved in an XML node, the XML data block is ignored. You can specify static or dynamic properties (for example: ${application.id} or ${session.altio.logon.name}) in the XML data block. All property references will be substituted at run-time and unresolved properties will be left blank.
In the Description field enter a description for the XML data. This is optional.

Data mappings let you define properties to be used in your composite service. You can therefore use it to overwrite property values (for example client.XXX). The values can be a fixed string (for example 123) or an XPath to a node (for example: /XML/USER). You can use it to pass return XML data from one service to another.
Data Mappings can be defined at the composite service level, which is a Data mapping group node below the main Service node:

They can also be defined at the individual service level
which is a Data mapping group node inside a service:
You can set the mapping to an XML node by specifying an XPath. In following example, dummy.data is mapped to self::*, which is the current global top level node. When the same node is defined inside a service, self::* points to the return XML of that service. If the service does not return XML, all mappings defined inside that service are ignored.

You can execute multiple services from within a composite service. These services are executed sequentially. Like an XML data block, XML return data can be merged into the current XML data by specifying an XPath.
Services normally take arguments passed in from AltioLive client (for example: client.XXX), but you can use Data mappings (See Data mappings section) to pass XML result from one service to another. You can also configure your Composite Service to abort processing when a service fails. To do so check the Abort on failure? box.
Parallel services are executed in parallel to improve performance. To add services to be executed in parallel, you need to first create a Parallel service group and add individual services to it. Services to be executed in parallel are configured the same way as if they are sequential service. Services inside a Parallel service group are independent, therefore cannot take return XML data from another service within the same parallel service group.
From the Response Tab you can specify whether this composite service will return XML data or not. You can also specify how to retrieve Timestamp information from the return XML.
Set the Output type to XML or EMPTY.
Please note: This only applies to XML Service Functions.
Check this box if you want the Timestamp to be extracted from a customized location. If this option is selected you can set the Element and Attribute for locating timestamp information. By default Timestamp are extracted from a Timestamp Attribute on the root element of the XML returned by the Service.
Please
note: This option is useful when the return data doesn't contain Timestamp
information. However, if you use MASTER-MASTER cluster configuration,
data might be lost in fail over situation, because the timestamp value
for a data block can be different on two Presentation Servers.
Please also note: that APS uses Java currentTimeMillis()
to set the timestamp. Although its precision is down to 1 ms, the problem
is that default timing systems on the native platforms are, in general,
of low resolution. The currentTimeMillis is updated every 10ms ~ 16 ms.
Therefore it is possible that 2 updates arrive in order but end up in
the same millisecond.
Check this box if you want the Presentation Server to use system clock for the Timestamp value.
Set this field to an XPath statement pointing to the element containing Timestamp information. By default the Presentation Server continues to find Timestamp information from root element. If more than one element matches, only the first element is used.
Specify the attribute name containing the Timestamp info or TEXT() to indicate that the element's text contains the timestamp. By default the Presentation Server finds Timestamp information from Timestamp default attribute.
Specify whether the Timestamp field is to be read as a Date/Time or as an Integer. By default the Type is set to Integer.
Specify the Format used to parse the Timestamp from the specified Element and Attribute. For a Date/Time this should be a format recognized by java.text.SimpleDateFormat. For an Integer this should be a format recognized by java.text.DecimalFormat. By default if the Type is set to Integer then the Timestamp Attribute is read as an Integer.
Please note: The XSL file could potentially add or remove Elements, Attributes, change names of Elements or Attributes. Using this feature requires that a JAXP compliant XSLT library is available on the servlet engine's CLASSPATH, for example Xalan, Apache's open source XSLT library (xalan.jar).
Place your XSL file in the XSL sub-directory (under the Application root directory) as the Transformation XSL file drop-down menu displays only the XSL files in that directory.
Specify the XSL file you want to use to transform return XML data before it is sent to the client.
Check this box if you want this service to create a new transformer instance every time it does the transformation. By default this option is set to false.
The Acknowledgement tab configures messages that can be displayed on success or failure of the composite service.

On Success:
Source:How to create success message to send to the client, if any. Possible values are NONE and DEFINE.
Text: If Source is set to DEFINE, this is the message that is sent back.
On Failure:
Source: How to create failure message to send to the client, if any. Possible values are NONE, DEFINE and FAULT. Setting Source to FAULT allows you to send back whatever failure message from a particular service when it fails.
Text: If Source is set to DEFINE, this is the message that is sent back.
The Test tab allows a COMPOSITE service to be tested. When you click this tab, the Application Manager will verify if the service is configured correctly. A message will be shown if the service has not been configured correctly. You can find out the cause of the problem by validating the configuration. You need to have valid configuration to test your service.

In the Test value cell enter a value to test the Composite Service Functions.
Click the Test Service button. A Test Results window is displayed with the execution messages and return data. See picture below:
Please note: that this is not a simulated test. Whatever service it invokes it may change the state of your backend data source.
