.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 IVTNO;
namespace IVTNORemoteClient
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
IVTNO.RemoteIVTNO remoteIVTNO = null;
try
{
RemotingConfiguration.Configure("C:\\Program Files\\Attachmate\\EAI\\IMSClient\\samples\\IVTNO\\remote\\IVTNO\\RemoteIVTNOClient.config");
remoteIVTNO = new IVTNO.RemoteIVTNO();
remoteIVTNO.open();
IVTNO.IVTNOInput.input input = new IVTNO.IVTNOInput.input();
input.INPUT_RCD = new IVTNO.IVTNOInput.input_INPUT_RCD();
input.INPUT_RCD.IN_TRNCODE = "IVTNO";
input.INPUT_RCD.IN_CMD = "DISPLAY";
input.INPUT_RCD.IN_LASTNAME = "LAST1";
input.INPUT_RCD.IN_FIRSTNAME = "";
input.INPUT_RCD.IN_EXTN = "";
input.INPUT_RCD.IN_ZIP = "";
IVTNO.IVTNOOutput.output output = remoteIVTNO.IVTNO(input);
System.Console.WriteLine(output.OUTPUT_RCD.OUT_MSG);
System.Console.WriteLine(output.OUTPUT_RCD.OUT_CMD);
System.Console.WriteLine(output.OUTPUT_RCD.OUT_LASTNAME);
System.Console.WriteLine(output.OUTPUT_RCD.OUT_FIRSTNAME);
System.Console.WriteLine(output.OUTPUT_RCD.OUT_EXTN);
System.Console.WriteLine(output.OUTPUT_RCD.OUT_ZIP);
}
catch (Exception xx)
{
System.Console.Error.WriteLine(xx);
}
finally
{
if ( remoteIVTNO != null )
remoteIVTNO.close();
}
}
}
}
Sample Configuration File: RemoteIVTNOClient.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.runtime.remoting>
<application>
<client url="http://localhost/IVTNO">
<activated type="IVTNO.RemoteIVTNO, IVTNO"/>
</client><channels>
<channel ref="http">
<clientProviders>
<formatter ref="binary"/>
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>