Server-activated Remote Object Client Sample: Hosted in a Custom Application
Whenever a Web service or a remote object is generated, a configuration file is also created. Below is a sample of a simple task execution using a server-actived remote object hosted in a custom application and a sample configuration file.
using System;
using System.Runtime.Remoting;
namespace CSharpClient
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
Test.RemoteTest remoteTest = null;
try
{
RemotingConfiguration.Configure("RemoteTestClient.config");
remoteTest = new Test.RemoteTestFactory().createRemoteTest();
remoteTest.open();
Test.Task1Input.Task1ScreenInputs inputs = new Test.Task1Input.Task1ScreenInputs();
inputs.Input1 = "data";
Test.Task1Output.Task1ScreenOutputs outputs = remoteTest.Task1(inputs);
System.Console.WriteLine(outputs.Output1);
}
catch (Exception xx)
{
System.Console.Error.WriteLine(xx);
}
finally
{
remoteTest.close();
}
}
}
}
Sample Configuration File for Server-activated RemoteTestClient.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown type="Test.RemoteTestFactory, Test" url="tcp://localhost:8989/Test"/>
</client>
<channels>
<channel ref="tcp">
<clientProviders>
<formatter ref="binary"/>
</clientProviders>
</channel>>
</channels>
</application>
</system.runtime.remoting>
</configuration>