Hi,
I am trying to insert a new lead containing data set as type OptionSet Value, however I am getting the following error message:
The formatter threw an exception while trying to deserialize the message:
There was an error while trying to deserialize parameter schemas.microsoft.com/.../Services:request.
The InnerException message was 'Error in line 1 position xxxx.
Element 'schemas.datacontract.org/.../System.Collections.Generic:value' contains data from a type that maps to the name 'schemas.microsoft.com/.../Services:OptionSetValue'.
The deserializer has no knowledge of any type that maps to this name.
Consider changing the implementation of the ResolveName method on your DataContractResolver to return a non-null value for name 'OptionSetValue' and namespace 'schemas.microsoft.com/.../Services'.'.'. Please see InnerException for more details.
The request is being sent using PHP and the soap body is shown below. If the field containing the option value is removed the lead is successfully created.
<s:Body>
<Execute xmlns="schemas.microsoft.com/.../Services" xmlns:i="www.w3.org/.../XMLSchema-instance">
<request i:type="a:CreateRequest" xmlns:a="schemas.microsoft.com/.../Contracts">
<a:Parameters xmlns:b="schemas.datacontract.org/.../System.Collections.Generic">
<a:KeyValuePairOfstringanyType>
<b:key>Target</b:key>
<b:value i:type="a:Entity">
<a:Attributes>
<a:KeyValuePairOfstringanyType>
<b:key>firstname</b:key>
<b:value i:type="c:string" xmlns:c="www.w3.org/.../XMLSchema">Lead Name</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>lastname</b:key>
<b:value i:type="c:string" xmlns:c="www.w3.org/.../XMLSchema">Last name</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>emailaddress1</b:key>
<b:value i:type="c:string" xmlns:c="www.w3.org/.../XMLSchema">lead@email.co.uk</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>telephone1</b:key>
<b:value i:type="c:string" xmlns:c="www.w3.org/.../XMLSchema">011111111111</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>description</b:key>
<b:value i:type="c:string" xmlns:c="www.w3.org/.../XMLSchema">Message</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>subject</b:key>
<b:value i:type="c:string" xmlns:c="www.w3.org/.../XMLSchema">Website Enquiry</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>d:at_enquiry</b:key>
<b:value i:type="OptionSetValue">115500001</b:value>
</a:KeyValuePairOfstringanyType>
</a:Attributes><a:EntityState i:nil="true" />
<a:FormattedValues>
<a:KeyValuePairOfstringstring>
<b:key>d:at_enquiry</b:key>
<b:value>Website</b:value>
</a:KeyValuePairOfstringstring>
</a:FormattedValues>
<a:Id>00000000-0000-0000-0000-000000000000</a:Id>
<a:LogicalName>lead</a:LogicalName><a:RelatedEntities />
</b:value>
</a:KeyValuePairOfstringanyType>
</a:Parameters><a:RequestId i:nil="true" />
<a:RequestName>Create</a:RequestName>
</request>
</Execute>
</s:Body>
*This post is locked for comments