Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hope someone can help me on this one. I have an SAO, which includes a method that returns a marshalByRefObject. The server compiles without a hitch. I then run soapsuds against it to get the client interface dll. On the client side I can get the SAO object, no problem and can access methods on it that return regular value types. However when I invoke the method that returns the additional marshalByRefObject I get the exception below.

 

Now I know that if I was returning an object by value I'd have to create a generic.dll containing the value type so both the server and client can see it then run soapsuds with the -gc option but in this case I'm using marshalByRef's only so this shouldn't apply, right?

 

I've also included the code I'm using below.

 

I'd appreciate any tips you can give me on this.

 

-Jon.

 

System.InvalidCastException: Return argument has an invalid type.

at System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object arg, Ty

pe paramType)

at System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage

msg, Object[] outArgs, Object returnValue)

at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req

Msg, IMessage retMsg)

at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa

ta, Int32 type)

at PortfolioServer.PortfolioManager.getRealPortfolio() in c:\documents and se

ttings\jmeadows\my documents\visual studio projects\portfolioclient\portfolioser

ver.cs:line 18

at PortfolioClient.Client.Main(String[] args) in c:\documents and settings\jm

eadows\my documents\visual studio projects\portfolioclient\class1.cs:line 40

 

Client:

 

...

HttpChannel cn = new HttpChannel();

ChannelServices.RegisterChannel( cn );

 

PortfolioManager mgr = (PortfolioManager) Activator.GetObject(

typeof( PortfolioManager),

"http://localhost:1410/PortfolioManager.soap" );

 

//This works fine, just returning a string from the remote obj.

String aString = mgr.getAString();

 

//This works less well.

Portfolio aPortfolio = mgr.getPortfolio();

...

 

Server:

 

...

public class PortfolioManager: MarshalByRefObject

{

 

static void Main( String args[] )

{

HttpChannel cn = new HttpChannel( 1410 );

ChannelServices.RegisterChannel( cn );

 

RemotingConfiguration.RegisterWellKnownServiceType(

typeof( PortfolioManager ),

"PortfolioManager.soap",

WellKnownObjectMode.Singleton);

}

 

public Portfolio getPortfolio( String userid )

{

return new Portfolio();

}

 

}

 

 

public class Portfolio: MarshalByRefObject

{

private String tester;

 

public String getTester()

{

return tester;

}

 

}

...

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...