New Posts New Posts RSS Feed: Good working example of Remote Server Method
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Good working example of Remote Server Method

 Post Reply Post Reply
Author
BillG View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 05-Dec-2007
Location: Monroe, MI
Posts: 233
Post Options Post Options   Quote BillG Quote  Post ReplyReply Direct Link To This Post Topic: Good working example of Remote Server Method
    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
 
Back to Top
mikewishart View Drop Down
Groupie
Groupie
Avatar

Joined: 26-Feb-2010
Location: Reno, NV
Posts: 49
Post Options Post Options   Quote mikewishart Quote  Post ReplyReply Direct Link To This Post 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";
    }
  }
}

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down