在使用SOAP端点的Dynamics CRM 2011中创建记录时,Currency字段设置为0.00

时间:2014-10-31 20:51:20

标签: php soap dynamics-crm-2011

我正在尝试向我的Microsoft Dynamics crm发送XML SOAP请求。记录已创建,但由于某种原因,我的货币字段设置为0.00而不是我提供的值。我使用带有sdk的SOAPlogger来确保请求是相同的,并且当我使用C#执行时,货币字段设置正确,但是当我尝试使用PHP发出请求时,字段设置不正确。

以下是发送的创建请求。

<Create 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>new_invoiceddate</b:key>
                <b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:dateTime">2014-07-31T00:00:00Z</b:value>
            </a:KeyValuePairOfstringanyType>
            <a:KeyValuePairOfstringanyType>
                <b:key>new_commissiondate</b:key>
                <b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:dateTime">2014-10-01T00:00:00Z</b:value>
            </a:KeyValuePairOfstringanyType>
            <a:KeyValuePairOfstringanyType>
                <b:key>new_commissionamount</b:key>
                <b:value i:type="a:Money">
                    <a:value>28.08</a:value>
                </b:value>
            </a:KeyValuePairOfstringanyType>
            <a:KeyValuePairOfstringanyType>
                <b:key>new_carrier</b:key>
                <b:value i:type="a:EntityReference">
                    <a:Id>9713bd59-5bca-e211-bd6d-001b21a73d70</a:Id>
                    <a:LogicalName>new_carrier</a:LogicalName>
                    <a:Name i:nil="true"/>
                </b:value>
            </a:KeyValuePairOfstringanyType>
            <a:KeyValuePairOfstringanyType>
                <b:key>new_usagebilled</b:key>
                <b:value i:type="a:Money">
                    <a:value>140.40</a:value>
                </b:value>
            </a:KeyValuePairOfstringanyType>
            <a:KeyValuePairOfstringanyType>
                <b:key>new_name</b:key>
                <b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:string">Action Water Sports - 10/01/2014</b:value>
            </a:KeyValuePairOfstringanyType>
            <a:KeyValuePairOfstringanyType>
                <b:key>new_invoicenumber</b:key>
                <b:value xmlns:c="http://www.w3.org/2001/XMLSchema" i:type="c:string">142125103</b:value>
            </a:KeyValuePairOfstringanyType>
            <a:KeyValuePairOfstringanyType>
                <b:key>new_commissiontype</b:key>
                <b:value xmlns:c="http://schemas.microsoft.com/xrm/2011/Contracts" i:type="a:OptionSetValue">
                    <a:Value>100000000</a:Value>
                </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>00000000-0000-0000-0000-000000000000</a:Id>
        <a:LogicalName>new_carriercommission</a:LogicalName>
        <a:RelatedEntities xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic"/>
    </entity>
</Create>

1 个答案:

答案 0 :(得分:0)

由于某种原因,某些节点的名称全部为小写,而其他节点大写(Microsoft的奇怪不一致之一),因此当嵌套在另一个名为“value”的节点中时,“值”节点应该是“值”,例如:

<a:KeyValuePairOfstringanyType>
   <b:key>new_commissionamount</b:key>
   <b:value i:type="a:Money">
      <a:value>28.08</a:value>
   </b:value>
</a:KeyValuePairOfstringanyType>

事实上应该是:

<a:KeyValuePairOfstringanyType>
   <b:key>new_commissionamount</b:key>
   <b:value i:type="a:Money">
      <a:Value>28.08</a:Value>
   </b:value>
</a:KeyValuePairOfstringanyType>

请注意本例中“b:value”如何保持小写。