.NET Remote Client Object Sample Code: Client-activated, IIS Hosted, Client
A simple console application that demonstrates how to execute a task via a client-activated remote object. The remote component is hosted in IIS and includes a corresponding configuration file.
using System;
using System.Runtime.Remoting;
using AMNUtask;
namespace AMNUtaskRemote
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
AMNUtask.RemoteAMNUtask remoteAMNUtask = null;
try
{
RemotingConfiguration.Configure("C:\\Program Files\\Attachmate\\EAI\\CICSClient\\samples\\AMNU\\remote\\AMNUtaskRemote\\RemoteAMNUtaskClient.config");
remoteAMNUtask = new AMNUtask.RemoteAMNUtask();
remoteAMNUtask.open();
AMNUtask.AMNUInput.input input = new AMNUtask.AMNUInput.input();
input.CICSUserInfo = new AMNUtask.AMNUInput.input_CICSUserInfo();
input.CICSUserInfo.USER_ID = "USERID";
input.CICSUserInfo.PASSWORD = "PW";
input.FILE_XACT = new AMNUtask.AMNUInput.input_FILE_XACT();
input.FILE_XACT.COMMCODE = "2";
input.FILE_XACT.FILENAME = "FILEA";
input.FILE_XACT.REC_KEY_FLD = "000102";
AMNUtask.AMNUOutput.output output = remoteAMNUtask.AMNU(input);
System.Console.WriteLine("NAME: " + output.FILE_XACT.FILEREC.NAME);
}
catch (Exception xx)
{
System.Console.Error.WriteLine(xx);
}
finally
{
if (remoteAMNUtask != null)
remoteAMNUtask.close();
}
}
}
}
Sample Configuration File: RemoteAMNUClient.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.runtime.remoting>
<application>
<client url="http://localhost/AMNUtask">
<activated type="AMNUtask.RemoteAMNUtask, AMNUtask">
</client><channels>
<channel ref="http">
<clientProviders>
<formatter ref="binary"/>
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>