Below is the example of using the ForeExec operation to execute method with passing repository objects as parameter values. The request contains name of the method to be executed and the development environment object that contains method's implementation. Parameter values contain repository connection monikers and a repository object. The executed method has the following syntax:
Method execution parameters:
{ "ForeExec" : { "tFore" : { "id" : "S1!M!7360" }, "tArg" : { "methodName" : "WorkWithObject", "args" : { "it" : [ { "k" : "1", "value" : "S1!M" }, { "k" : "2", "value" : "S1!M!S!E1" } ] } } } }
{ "ForeExecResult" : { "result" : "" } }
public static ForeExecResult ExecMethodWithObject(MbId mb, string assmId, string methodName, string objMoniker)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tExec = new ForeExec()
{
tArg = new ForeExecArg()
{
methodName = methodName,
//Monikers as parameters values
args = new OdArg[2]
{
new OdArg(){ k = 1, value = mb.id },
new OdArg(){ k = 2, value = objMoniker }
}
},
//Moniker of development environment object with method implementation
tFore = new ForeId()
{
id = mb.id + "!" + FindObjectById(mb, assmId).k
}
};
//Execute method
var result = somClient.ForeExec(tExec);
return result;
}
See also: