首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Dynamics 2011 (IFD) CRM SOAP更新不起作用

Dynamics 2011 (IFD) CRM SOAP更新不起作用
EN

Stack Overflow用户
提问于 2016-06-02 18:35:26
回答 2查看 117关注 0票数 1

我正在使用PHP连接到Dynamics 2011 IFD,并成功地验证和检索我的web应用程序的联系人。

然而,我正在努力更新联系人。

我的SOAP请求(如下)返回'Bad Request‘,不幸的是,我没有足够的服务器管理员访问权限来启用更有用的错误报告。有没有人能发现这个XML中有什么明显的问题呢?

代码语言:javascript
复制
$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‘函数正在为retrieve/retrieveMultiple请求返回可用的auth标头。这里唯一的区别是指定了Update方法:

代码语言:javascript
复制
<a:Action s:mustUnderstand="1">http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Update</a:Action>
EN

回答 2

Stack Overflow用户

发布于 2016-06-03 08:12:36

这是一个大胆的猜测,因为我自己还没有执行过这样的更新。

去掉这个比特,

代码语言:javascript
复制
<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>

这表明您正在尝试设置记录id字段,这不是您通常要做的事情。

您有一个似乎将您的更新与单个记录相关联的位,所以我怀疑上面的内容不是必需的。

代码语言:javascript
复制
<a:Id>'.$contactid.'</a:Id>
票数 1
EN

Stack Overflow用户

发布于 2016-06-03 16:02:43

我从来没有用过它,但是看起来有一个project on Git可以解决这个问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37589407

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档