简体   繁体   中英

PHP Unable to set empty value to lookup field on Dynamics CRM 2013

I am using PHP SDK https://github.com/Rocketeer007/php-dynamics-crm-2011 to connect Dynamics CRM and try to set empty value in lookup field but didn't get success. Following are SOAP request and response data

Request

<?xml version="1.0" encoding="UTF-8"?>
<Update xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:b="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
   <entity>
      <b:Attributes xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
         <b:KeyValuePairOfstringanyType>
            <c:key>key name</c:key>
            <c:value xmlns:d="http://www.w3.org/2001/XMLSchema" i:type="d:string">Test</c:value>
         </b:KeyValuePairOfstringanyType>
         <b:KeyValuePairOfstringanyType>
            <c:key>Entity Name</c:key>
            <c:value i:type="b:EntityReference">
               <b:Id i:nil="true" />
               <b:LogicalName>Lookup Entity Name</b:LogicalName>
               <b:Name i:nil="true" />
            </c:value>
         </b:KeyValuePairOfstringanyType>
      </b:Attributes>
      <b:EntityState i:nil="true" />
      <b:FormattedValues xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
      <b:Id>guild</b:Id>
      <b:LogicalName>entity name</b:LogicalName>
      <b:RelatedEntities xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
   </entity>
</Update>

Response

Uncaught SoapFault exception: [Sender] The formatter threw an exception while trying to deserialize the message

what am I doing wrong here?

2011 seems to be really old. Check following toolkit instead - https://github.com/AlexaCRM/php-crm-toolkit I'm pretty sure it's up-to-date.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM