Below is the example of using the SetMbUpdate operation to start the update installation. The update moniker and installation execution parameters are sent in the query. The operation is executed in synchronous mode but it does not wait till the installation finishes. To monitor update installation state, call the GetMbUpdate operation periodically. The update installation will be finished when the SetMbUpdateResult.meta.execute.state field returns Finished or FinishedWithError.
The information about installation results is sent in the response.
{
"SetMbUpdate" :
{
"tMbUpdate" :
{
"id" : "HIDMDIEFBHCHGOAEGIHPHLGMDNKCMEDEBIGGMJJBPLDGFEOG!M!S!MbUpdOJFBNIEFBHCHGOAEJCKDBGBGODBNBCBEIIDAJOFDEKCIONGC"
},
"tArg" :
{
"pattern" :
{
"execute" : "true"
},
"meta" :
{
"execute" :
{
"command" : "Apply",
"async" : "false"
}
},
"metaGet" :
{
"execute" : "true"
}
}
}
}
{
"SetMbUpdateResult" :
{
"id" :
{
"id" : "HIDMDIEFBHCHGOAEGIHPHLGMDNKCMEDEBIGGMJJBPLDGFEOG!M!S!MbUpdOJFBNIEFBHCHGOAEJCKDBGBGODBNBCBEIIDAJOFDEKCIONGC"
},
"meta" :
{
"execute" :
{
"resolveTimeout" : "600000",
"state" : "Waiting",
"callback" :
{
"onProgress" :
{
"stage" : "Start",
"total" : "1",
"current" : "1"
}
}
}
}
}
}
public static SetMbUpdateResult ApplyUpdate(string moniker)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
// Operation execution parameters
var tSet = new SetMbUpdate()
{
tArg = new SetMbUpdateArg()
{
pattern = new MbUpdateMdPattern()
{
execute = true
},
meta = new MbUpdateMd()
{
execute = new MbUpdateExecute()
{
command = MbUpdateExecuteCommand.Apply,
async = false
},
},
metaGet = new MbUpdateMdPattern()
{
execute = true
}
},
tMbUpdate = new MbUpdateId() { id = moniker }
};
// Start update installation
var result = somClient.SetMbUpdate(tSet);
return result;
}
See also: