【问题标题】:Dynamics 2011 (IFD) CRM SOAP Update not workingDynamics 2011 (IFD) CRM SOAP 更新不起作用
【发布时间】: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


    【解决方案1】:

    这是一个疯狂的猜测,我自己没有执行过这样的更新。

    去掉这个位,

    <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 字段,这不是您通常会做的事情。

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

    <a:Id>'.$contactid.'</a:Id>
    

    【讨论】:

    • 非常感谢您的回复 - 遗憾的是它没有任何区别。好建议。欣赏它。
    【解决方案2】:

    没用过,不过好像有project on Git可以处理。

    【讨论】:

    • 这看起来是为了连接到托管的 live.com 版本的 Dynamics,但我肯定会查看代码并仔细检查那里没有任何线索。谢谢。
    猜你喜欢
    • 1970-01-01
    • 2015-10-05
    • 2013-03-02
    • 2012-01-21
    • 2012-10-27
    • 2018-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多