【发布时间】:2016-06-02 10:35:26
【问题描述】:
我正在使用 PHP 连接到 Dynamics 2011 IFD,并成功地对我的 Web 应用程序中的联系人进行身份验证和检索。
但是,我正在努力更新联系人。
我的 SOAP 请求(如下)返回“错误请求”,不幸的是,我没有足够的管理员访问服务器权限来启用更有用的错误报告。任何人都可以在这个 XML 中发现任何可能是问题的明显内容吗?
$request = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
'.$this->crmAuth->GetSoapHeaderOnPremise("Update").'
<s:Body>
<Update xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<entity xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts">
<a:Attributes xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<a:KeyValuePairOfstringanyType>
<b:key>contactid</b:key>
<b:value i:type="c:guid" xmlns:c="http://schemas.microsoft.com/2003/10/Serialization/">'.$contactid.'</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>firstname</b:key>
<b:value i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema">'.$firstname.'</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>lastname</b:key>
<b:value i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema">'.$lastname.'</b:value>
</a:KeyValuePairOfstringanyType>
</a:Attributes>
<a:EntityState i:nil="true" />
<a:FormattedValues xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<a:Id>'.$contactid.'</a:Id>
<a:LogicalName>contact</a:LogicalName>
<a:RelatedEntities xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
</entity>
</Update>
</s:Body>
</s:Envelope>'
“getSoapHeaderOnPremise”函数正在为检索/检索多个请求返回有效的身份验证标头。这里唯一的区别是指定了 Update 方法:
<a:Action s:mustUnderstand="1">http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Update</a:Action>
【问题讨论】:
标签: php soap dynamics-crm-2011 microsoft-dynamics