[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

How to pass an Object[] to the server?

(Max)

7/22/2004 2:08:00 AM

Hi,

I got stuck with the following problem.
I would like the client to invoke a method implemented on the server
with the following prototype:
void DoSomething(Object[] inputs);

This method is defined in a separate assembly shared by the client and
the server. This assembly contains the definition of an interface:
public interface AbsServer
{
void DoSomething(Object[] inputs);
}

On the client, I do something like this:
int N = 3;
double[] a = new double[N];
double[] b = new double[3*N];
double[] c = new double[3*N];
double t = 0.001;

Object[] inputs = new Object[5]{N, a, b, c, t};

Factory f = new Factory();
AbsServer s = f.CreateServer("MyServer");

s.DoSomething(inputs);

What I am trying to do is to make the signature of DoSomething
generic, so I can pass in any number of variables of different types.

Question #1: is this the way to achive this goal or there are better
solutions available?

The code compiles fine, but when I run it, I get an error saying:
The argument type System.Object[] cannot be converted into parameter
type System.Int32

Question #2: why am I getting this error?

The web.config file is:
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="http">
<serverProviders>
<provider ref="wsdl" />
<formatter ref="soap" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>
<service>
<wellknown mode="Singleton" type="myNamespace.Myserver,
Server"
objectUri="MyServer.soap" />
</service>
</application>
<customErrors mode="off"/>
</system.runtime.remoting>
</configuration>

And the client.config is:
<configuration>
<system.runtime.remoting>
<application name="Factory">
<client url="http://BULL/AbsFactory">
<wellknown type="myNamespace.MyServer, Server"
url="http://BULL/AbsFactory/MyServer.soap"/>
</client>
<channels>
<channel ref="http" />
</channels>
</application>
</system.runtime.remoting>
</configuration>


Thanks!