How to update Configuration Item's CMDB attribute fields on a CI using SOAP

Document ID : KB000098353
Last Modified Date : 31/05/2018
Show Technical Document Details
Introduction:
This article provides a sample code for CA SDM SOAP Web Services API to update a CI's CMDB attributes.
Question:
How do you update a Configuration Item's CMDB attribute fields on a CI using CA SDM SOAP API?
Answer:
CMDB attributes on a CI are part of extension tables and not directly on the CI object/table itself. 

Example: A CI of class:Server / Family: Hardware.Server would have the CMDB attributes as part of one extension table, while a CI of class:Mobile Phone/Family:Telecom.Wireless would have a totally different set of CMDB attributes.

One needs to update the extension table values via SOAP's updateObject method to be able to update the CMDB attributes. Below is an example:

1) Consider a Hardware.Server CI for this test case, with an id of U'71DD87A27596214EA7E02564B2557610' 
2) For every Hardware.Server CIs, there is at least one record in the assoc_har_serx
3) In our case, you can use below method to select what all exists for the above CI:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ca.com/UnicenterServicePlus/ServiceDesk"> 
<soapenv:Header/> 
<soapenv:Body> 
<ser:doSelect> 
<sid>762348888</sid> 
<objectType>har_serx</objectType> 
<whereClause>id=U'71DD87A27596214EA7E02564B2557610'</whereClause> 
<maxRows>-1</maxRows> 
<attributes> 
<!--1 or more repetitions:--> 
</attributes> 
</ser:doSelect> 
</soapenv:Body> 
</soapenv:Envelope> 

4) To update existing attributes (printer and phys_mem in this case below) in this table, you can use the updateObject method:
 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://www.ca.com/UnicenterServicePlus/ServiceDesk"> 
<soapenv:Header/> 
<soapenv:Body> 
<ser:updateObject> 
<sid>762348888</sid> 
<objectHandle>har_serx:71DD87A27596214EA7E02564B2557610</objectHandle> 
<attrVals> 
<!--1 or more repetitions:--> 
<string>printer</string> 
<string>test new</string> 
<string>phys_mem</string> 
<string>16GB</string> 

</attrVals> 
<attributes> 
<!--1 or more repetitions:--> 
<string>printer</string> 
<string>phys_mem</string> 
</attributes> 
</ser:updateObject> 
</soapenv:Body> 
</soapenv:Envelope>