SetModule

Syntax

SetModuleResult SetModule(OdId tObject, SetModuleArg tArg)

Parameters

tObject. Unit moniker.

tArg. Operation execution parameters.

Description

The SetModule operation is used to set up unit and start algorithms implemented in the unit.

Comments

To execute the operation, in the tObject parameter specify moniker of the repository object that is unit. The object moniker can be obtained on executing the GetObjects operation. In the tArg.meta parameter specify new unit metadata that should be applied. The operation changes the list of links to other assemblies. Changes are saved on executing the operation. The tArg.run parameter enables the user to start entry point that should be implemented in the unit.

The operation results in the list of messages that can be displayed by the executed code in the console, including compiler messages.

Example

Below is the example of using the SetModule operation to start the unit for execution. The request contains moniker of unit in the repository. The response contains text of messages displayed in the console on execution. The C# example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier example.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SetModule xmlns="http://www.fsight.ru/PP.SOM.Som">
<tObject xmlns="">
  <id>S1!M!172002</id>
  </tObject>
<tArg xmlns="">
  <dontCompile>true</dontCompile>
  <run>true</run>
  </tArg>
  </SetModule>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetModuleResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <consoleOutput xmlns="">The main procedure is running. The object is created. </consoleOutput>
  </SetModuleResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"SetModule" :
{
"tObject" :
{
"id" : "S1!M!172002"
},
"tArg" :
{
"dontCompile" : "true",
"run" : "true"
}
}
}

JSON response:

{
"SetModuleResult" :
{
"consoleOutput" : "The main procedure is running. The object is created. "
}
}
public static SetModuleResult RunModule(MbId mb, string modId)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetModule()
{
tArg = new SetModuleArg()
{
dontCompile = true,
run = true
},
//Create object moniker
tObject = new OdId() { id = mb.id + "!" + FindObjectById(mb, modId).k }
};
//Start unit
var result = somClient.SetModule(tSet);
return result;
}

See also:

Working with Development Environment