在线将选择列表值发送到动态CRM,以使用Soap php创建销售线索

时间:2018-12-10 05:17:12

标签: php api soap dynamics-crm dynamics-crm-online

我正在尝试使用php中的肥皂在线创建crm 365中的线索。我可以通过发送肥皂请求成功创建销售线索,但是我也想发送销售线索来源,这是crm中的一个选择列表。这是我在php中的代码。不知道要使用哪种数据类型(int32或选择列表),但是两者都不起作用。

<b:KeyValuePairOfstringanyType>
            <c:key>leadsourcecode</c:key>
            <c:value i:type="d:OptionSetValue" xmlns:d="http://www.w3.org/2001/XMLSchema">100000010</c:value>
        </b:KeyValuePairOfstringanyType>';

我收到此错误:

Sendera:DeserializationFailedThe formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://schemas.microsoft.com/xrm/2011/Contracts/Services:entity. The InnerException message was 'Error in line 22 position 82. Element 'http://schemas.datacontract.org/2004/07/System.Collections.Generic:value' contains data from a type that maps to the name 'http://www.w3.org/2001/XMLSchema: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 'http://www.w3.org/2001/XMLSchema'.'. Please see InnerException for more details.

2 个答案:

答案 0 :(得分:0)

你可以试试吗?

<a:keyvaluepairofstringanytype>
 <b:key>leadsourcecode</b:key>
 <b:value i:type="a:OptionSetValue">
  <a:value>100000010</a:value>
 </b:value>
</a:keyvaluepairofstringanytype>

答案 1 :(得分:0)

内部值标签需要具有大写V 。这是我用来更新状态原因并进行适当修改的代码。另外,不推荐使用SOAP端点,您应该移至WebAPI

request += "<a:KeyValuePairOfstringanyType>";
request += "<c:key>Status</c:key>";
request += "<c:value i:type=\"a:OptionSetValue\">";
request += "<a:Value>" + 2 + "</a:Value>";
request += "</c:value>";
request += "</a:KeyValuePairOfstringanyType>";