Print Page | Close Window

Good working example of Remote Server Method

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2331
Printed Date: 20-Oct-2025 at 2:54am


Topic: Good working example of Remote Server Method
Posted By: BillG
Subject: Good working example of Remote Server Method
Date Posted: 23-Nov-2010 at 2:03am
Does anyone have a good working example of calling a remote server method? I am having difficulties getting it to work with the examples in the documentation.
 
Bill
 



Replies:
Posted By: mikewishart
Date Posted: 23-Nov-2010 at 7:34pm
A simple one...

"ServerRPCs" is the module name.  It should be listed in the BOS Web.Config probeAssemblyNames and referenced by the BOS.

private const string RPCClassLocation = "Z.ServerRPCs.RemoteCalls.{0}, ServerRPCs";

EntityManager.InvokeServerMethodAsync(
        string.Format(RPCClassLocation, "GetStringRPC"),
        "GetString", r => {
          if (r.IsCompleted) { 
            Console.WriteLine((String)r.Result);
          } else { throw new Exception(r.Error.Message); }
       }, null );

namespace Z.ServerRPCs.RemoteCalls
{
  public class GetStringRPC
  {
    [AllowRpc]
    public static object GetString(IPrincipal principal, EntityManager mgr, params object[] args)
    {
      return "Some String";
    }
  }
}




Print Page | Close Window