Learning objectives At completion of this learning module, you will be familiar with:
The different types of steps that make up a service.
How to create a service in NexJ Studio.
How to bind a channel to a service.
How to add steps to a service, including script steps.
How to test a service.
Key concepts Services are used to tie together integration structures. In NexJ Studio, services are part of the Integration layer. Each service defines a series of steps, similar in concept to a workflow in the Business Model layer. A service passes a token from one step to the next, performing actions on the token at each step.
The steps available to services include:
Email - Sends an e-mail message.
Format - Serializes a message fom an internal format to its external raw format.
Invoke Service -Invokes an integration service.
Log - Creates log entries.
Parse - Deserializes a message from its external raw format to an internal format.
Persist - Updates business model objects from an object message.
Script - Executes custom logic from a Scheme script. The returned value is a message that is passed to the next step.
Send - Asynchronously sends a message through a channel.
Send/Receive - Synchronously sends a message through a channel and waits for a response. The response is a message that is passed to the next step.
Set Channel - Sets which channel is used for output.
Sync - Synchronizes an object message with business model objects.
Transform - Transforms a message into another type of message, which is then passed to the next step.
Creating a service
In this learning activity, you will create a new service.
Learning activity
To create a new service called training:EchoService:
In the Integration layer, select the Services tab.
Right-click the list area inside the tab and select New Service. The New Service dialog opens.
Name the service training:EchoService.
Click Finish. The new service opens in an editor dialog.
Binding an HTTP channel to the service
Let's create a new HTTP channel called training:EchoChannel and bind it to training:EchoService. With binding, when the channel receives a message, it passes it on to the service. When the service has finished processing the message, it sends a response message back through the channel.
Learning activity
To bind a channel to the service:
In the Integration layer, select the Channels tab.
Right-click the list area inside the tab and select New Channel. The New Channel dialog opens.
Specify the following values for the channel:
Name: training:EchoChannel
Channel Type: HTTP
Click Finish. The new channel opens in an editor.
Enter or drag and drop the following XML code on the Source tab.