When you add an application through the DE PMC, you must use the Add Application wizard. This wizard defines a consumer location to associate with your application, deploys your service package, and registers your application. After completing the steps with the wizard, your application should be ready to use.
%SOAM_HOME%\4.1\samples\DotNet\CS\SharingData\sharing_data_2003.sln
%SOAM_HOME%\4.1\samples\DotNet\CS\SharingData\sharing_data_2005.sln
%SOAM_HOME%\4.1\samples\DotNet\CS\SharingData\Client\SyncClient.cs
The service required to compute the input data along with additional application parameters are defined in the application profile:
%SOAM_HOME%\4.1\samples\DotNet\CS\SharingData\SharingDataDotNetCS.xml
The client creates a session with common data. It sends 10 input messages, and retrieves the output. The client then outputs "Hello Grid !!".
The service takes input data sent by client applications, returns the input data you have sent and replies "Hello Client !!" followed by the common data appended to the message. The service uses OnSessionEnter() to define attributes global to the session.
Common data is data that can be made available to service instances for the duration of a session.
Use common data when you need to set up the initial state of a service, and you only want to do it once, not on every task. Common data is useful for passing data from a client to a service. The service loads the data when the session is created.
You can use common data, for example, to set the environment in the service that is common to all tasks in a session. This way you only need to set the environment once, when the session is created.
Symphony attempts to use the same service instance for all tasks in a session. A service instance is made available to other sessions only when session workload completes, a session is closed or aborted, or when another session of higher priority is assigned the service instance.
In the synchronous client tutorial, input and output message objects were the same object. In this tutorial, different objects represent input and output. In addition, we are creating an additional object to represent common data.
Remember to mark your message and data handler classes with the Serializable attribute. This allows the objects to be serialized for transfer across the network.
As in the synchronous client tutorial, initialize the client and connect to the application. Then, create your session to group tasks.
When creating a session, use the common data object to pass data from the client application to the service.
In SyncClient.cs, we create a session and pass the common data object via the SessionCreationAttributes object.
As in the basic service tutorial, first define a service container. Then retrieve the common data sent by the client by implementing OnSessionEnter(). This method is called once by the middleware for the duration of the session to bind the service instance to the session.
In SampleService.cs, we use OnSessionEnter() to get common data and store it for later use within the scope of the session.
In this example, each time the OnInvoke() method is called by the middleware, we append the common data to the output string. We then set our output message as usual to send common data back with each of the replies.
After processing the input, use the OnSessionLeave() call to free the data for the session. The OnSessionLeave() method is called once by the middleware for every session that is created.
As with the basic service, run the container in the service main and catch exceptions.