简体   繁体   English

在带有SOAP端点的Dynamics CRM 2011中创建记录时,“货币”字段设置为0.00

[英]Currency field is set to 0.00 when creating record in Dynamics CRM 2011 with SOAP endpoint

I am trying to send an XML SOAP request to my Microsoft Dynamics crm. 我正在尝试向我的Microsoft Dynamics crm发送XML SOAP请求。 the record is created, but for some reason my currency fields are set to 0.00 instead of the value I provide. 记录已创建,但是由于某种原因,我的货币字段设置为0.00,而不是我提供的值。 I've used the SOAPlogger with the sdk to make sure the requests are identical and the currency fields are set right when I execute with C#, but when I try issuing the request with PHP the fields are not set right. 我已经将SOAPlogger与sdk一起使用,以确保请求相同,并且在使用C#执行时正确设置了货币字段,但是当我尝试使用PHP发出请求时,这些字段设置不正确。

Below is the create request being sent. 以下是正在发送的创建请求。

<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>

For some reason the names of some nodes is all lowercase whereas others are capitalised (one of Microsoft's weird inconsistencies), so it appears the "value" node should be "Value" when nested in another node called "value", eg: 由于某些原因,某些节点的名称全为小写,而其他节点的名称均为大写(Microsoft怪异的不一致之一),因此当嵌套在另一个称为“值”的节点中时,“值”节点似乎应为“值”,例如:

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

Should in fact be: 实际上应该是:

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

Notice how "b:value" remains all lowercase in this example. 注意在此示例中,“ b:value”如何保持全部小写。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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