Inserting New Element

Below is the example of using the SetRdsElements operation to insert a new element into an MDM dictionary. The new element is added to the root of the elements tree. To insert an element, specify the tArg.op and tArg.data fields. The tArg.data property contains element information. The response contains key of the inserted element.

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">
<SetRdsElements xmlns="http://www.fsight.ru/PP.SOM.Som">
<tRds xmlns="">
  <id>S1!M!S!N5</id>
  </tRds>
<tArg xmlns="">
  <op>Insert</op>
<key>
  <key />
  </key>
<data>
  <n>Element 1</n>
  <k />
  <h>false</h>
  <o>0</o>
  </data>
  </tArg>
  </SetRdsElements>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetRdsElementsResult 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>S1!M!S!N5</id>
  </id>
<key xmlns="">
  <key>3</key>
  </key>
  </SetRdsElementsResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"SetRdsElements" :
{
"tRds" :
{
"id" : "S1!M!S!N5"
},
"tArg" :
{
"op" : "Insert",
"key" :
{
"key" : ""
},
"data" :
{
"n" : "Element 1",
"k" : "",
"h" : "false",
"o" : "0"
}
}
}
}

JSON response:

{
"SetRdsElementsResult" :
{
"id" :
{
"id" : "S1!M!S!N5"
},
"key" :
{
"key" : "3"
}
}
}
public static SetRdsElementsResult InsertRdsElement(RdsId moniker, string elementName)
{
var somClient = new SomPortTypeClient(); //Proxy object for operation execution
//Operation execution parameters
var tSet = new SetRdsElements()
{
tArg = new SetRdsElementsArg()
{
op = RdsElementOperation.Insert,
key = new ElKey()
{
key = string.Empty
},
//Information about object to be added. Key is not specified, it will be generated on insert
data = new ElData()
{
k = string.Empty,
n = elementName
}
},
tRds = moniker
};
//Add element
var tResult = somClient.SetRdsElements(tSet);
return tResult;
}

See also:

SetRdsElements