FAQ: How do I send SOAP message to MDS web services to create EntityMembers with attributes other than Name and Code?
In Microsoft SQL Server Master Data Services (MDS), we can call the MDS web services, and the method EntityMembersCreate to create EntityMembers, which have attributes other than Name and Code. The .NET code is provided in the Reference section in this article.
However, you may like to use the SOAP message to create such EntityMembers. Since the Value property of an Attribute is Object type, if we assign a value to the property Value in the SOAP without convert the value to String explicitly, the XML parser can’t serialize it to String, and we will get DeserializationFailed error.
In order to convert a value to String in the SOAP message, you can add namespace xmlns:xsi=https://www.w3.org/2001/XMLSchema-instance to the SOAP message, and convert the value explicitly:
<ns0:Value xsi:type="a:string" xmlns:a="https://www.w3.org/2001/XMLSchema">102 XYZ</ns0:Value>
Here is the complete SOAP for your reference:
<ns0:EntityMembersCreateRequest xmlns:ns1="https://schemas.datacontract.org/2004/07/Microsoft.MasterDataServices.Services.DataContracts" xmlns:ns0="https://schemas.microsoft.com/sqlserver/masterdataservices/2009/09" xmlns:ns2="https://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ser="https://schemas.microsoft.com/2003/10/Serialization/" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" >
<ns0:Members>
<ns0:EntityId xsi:type="ns0:Identifier">
<ns0:Name>Unit1</ns0:Name>
</ns0:EntityId>
<ns0:Members>
<ns0:Member>
<ns0:Attributes>
<ns0:Attribute>
<ns0:Identifier xsi:type="ns0:Identifier">
<ns0:Name>Address1</ns0:Name>
</ns0:Identifier>
<ns0:Value xsi:type="a:string" xmlns:a="https://www.w3.org/2001/XMLSchema" >ABC</ns0:Value>
</ns0:Attribute>
<ns0:Attribute>
<ns0:Identifier xsi:type="ns0:Identifier">
<ns0:Name>Address2</ns0:Name>
</ns0:Identifier>
<ns0:Value xsi:type="a:string" xmlns:a="https://www.w3.org/2001/XMLSchema" >102 XYZ</ns0:Value>
</ns0:Attribute>
</ns0:Attributes>
<ns0:MemberId>
<ns0:Name>Test1</ns0:Name>
<ns0:Code>1010</ns0:Code>
<ns0:MemberType>Leaf</ns0:MemberType>
</ns0:MemberId>
</ns0:Member>
</ns0:Members>
<ns0:ModelId xsi:type="ns0:Identifier">
<ns0:Name>ConnectMDM</ns0:Name>
</ns0:ModelId>
<ns0:VersionId xsi:type="ns0:Identifier">
<ns0:Name>VERSION_1</ns0:Name>
</ns0:VersionId>
</ns0:Members>
</ns0:EntityMembersCreateRequest>
Reference
IService.EntityMembersCreate Method
https://technet.microsoft.com/en-us/library/microsoft.masterdataservices.iservice.entitymemberscreate.aspx