Opening Modeling Container

Below is the example of using the OpenMs operation to open a modeling container. The request contains a container moniker. The response contains moniker of opened modeling container instance. Any additional data is not obtained.

The C# example uses the FindObjectById function, which code is given in the Getting Object Description by Its Identifier section.

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">
<OpenMs xmlns="http://www.fsight.ru/PP.SOM.Som">
<tOb xmlns="">
  <id>GEGBFKLHGPMOFOAEIMFEBNKILLAKNJBEIKKFGPFLECLAJIMA!M!306480</id>
  </tOb>
<tArg xmlns="">
<args>
  <onlyProblem>false</onlyProblem>
  </args>
<metaGet>
  <obInst>true</obInst>
  <items>Get</items>
  </metaGet>
  </tArg>
  </OpenMs>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<OpenMsResult 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">
<id xmlns="">
  <id>GEGBFKLHGPMOFOAEIMFEBNKILLAKNJBEIKKFGPFLECLAJIMA!M!S!CHKGAJOLHGPMOFOAEAOFBOAAENDLELDBEHIBGFCIGDKEAEIKH</id>
  </id>
<meta xmlns="">
<obInst>
<obDesc ds="key 306480" isShortcut="0" isLink="0" ver="5" hf="0">
  <i>MODELSPACE</i>
  <n>Modeling container</n>
  <k>306480</k>
  <c>5121</c>
  <p>1580</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <trackElementDependents>0</trackElementDependents>
  <isPermanent>1</isPermanent>
  <isTemp>0</isTemp>
  </obDesc>
  </obInst>
  <dirty>0</dirty>
<items>
<its>
<it>
  <k>306485</k>
  <id>SCEN$TREE</id>
<n>Scenario tree</n>
  <vis>1</vis>
  <type>Folder</type>
  </it>
<it>
  <k>306493</k>
  <id>OBJ306493</id>
<n>Variables</n>
  <vis>1</vis>
  <type>Folder</type>
  </it>
<it>
  <k>306486</k>
  <id>OBJ306486</id>
<n>Variable A</n>
  <vis>1</vis>
  <type>Variable</type>
  </it>
<it>
  <k>306490</k>
  <id>OBJ306490</id>
<n>Variable B</n>
  <vis>1</vis>
  <type>Variable</type>
  </it>
<it>
  <k>306494</k>
  <id>OBJ306494</id>
<n>Model (Determinate equation)</n>
  <vis>1</vis>
  <type>Model</type>
  </it>
<it>
  <k>306495</k>
  <id>OBJ306495</id>
<n>Metamodel</n>
  <vis>1</vis>
  <type>MetaModel</type>
  </it>
<it>
  <k>306496</k>
  <id>OBJ306496</id>
  <n>Modeling problem</n>
  <vis>1</vis>
  <type>Problem</type>
  </it>
  </its>
  </items>
  </meta>
  <readOnly xmlns="">0</readOnly>
  </OpenMsResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"OpenMs" :
{
"tOb" :
{
"id" : "GEGBFKLHGPMOFOAEIMFEBNKILLAKNJBEIKKFGPFLECLAJIMA!M!306480"
},
"tArg" :
{
"args" :
{
"onlyProblem" : "false"
},
"metaGet" :
{
"obInst" : "true",
"items" : "Get"
}
}
}
}

JSON response:

{
"OpenMsResult" :
{
"id" :
{
"id" : "GEGBFKLHGPMOFOAEIMFEBNKILLAKNJBEIKKFGPFLECLAJIMA!M!S!CHKGAJOLHGPMOFOAEAOFBOAAENDLELDBEHIBGFCIGDKEAEIKH"
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "key 306480",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "5",
"@hf" : "0",
"i" : "MODELSPACE",
"n" : "Modeling container",
"k" : "306480",
"c" : "5121",
"p" : "1580",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"dirty" : "0",
"items" :
{
"its" :
{
"it" :
[
{
"k" : "306485",
"id" : "SCEN$TREE",
"n" : "Scenario tree",
"vis" : "1",
"type" : "Folder"
},
{
"k" : "306493",
"id" : "OBJ306493",
"n" : "Variables",
"vis" : "1",
"type" : "Folder"
},
{
"k" : "306486",
"id" : "OBJ306486",
"n" : "Variable A",
"vis" : "1",
"type" : "Variable"
},
{
"k" : "306490",
"id" : "OBJ306490",
"n" : "Variable B",
"vis" : "1",
"type" : "Variable"
},
{
"k" : "306494",
"id" : "OBJ306494",
"n" : "Model (Determinate equation)",
"vis" : "1",
"type" : "Model"
},
{
"k" : "306495",
"id" : "OBJ306495",
"n" : "Metamodel",
"vis" : "1",
"type" : "MetaModel"
},
{
"k" : "306496",
"id" : "OBJ306496",
"n" : "Modeling problem",
"vis" : "1",
"type" : "Problem"
}
]
}
}
},
"readOnly" : "0"
}
}
public static OpenMsResult OpenMs(MbId mb, string msId)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Set operation execution parameters
var tMsOp = new OpenMs()
{
tArg = new OpenMsArg()
{
args = new MsOpenArgs()
{
onlyProblem = false
},
metaGet = new MsMdPattern()
{
items = ListOperation.Get
}
},
// Create object moniker
tOb = new OdId() { id = mb.id + '!' + FindObjectById(mb, msId).k }
};
// Open modeling container
var result = somClient.OpenMs(tMsOp);
return result;
}

See also:

OpenMs: Operation