0

不确定为什么以下请求会出错,如下所示:

处理请求流时出错。请求应该是一个有效的顶级资源对象。

请求(某些细节由于明显的原因被混淆了):

POST http://someUrl.com/someUrl/XRMServices/2011/OrganizationData.svc/someSet HTTP/1.1
Connection: Keep-Alive
Content-Type: application/json; charset=utf-8
Accept-Encoding: gzip, deflate
Content-Length: 387
Host: someUrl.com

{
    "paymentid": {
        "Id": "00e3f661-8d28-e321-896e-00155dfd1d05",
        "LogicalName": "payment"
    },
    "invoiceid": {
        "Id": "00e3f661-8d28-e411-896e-00155dfd1d05",
        "LogicalName": "invoice"
    },
    "AppliedAmount": 1317.53000,
    "name": "Payment Applied",
    "postingstatus": "Posted",
    "transactioncurrencyid": {
        "Id": "80870a9b-329e-d421-8a22-00155d025001",
        "LogicalName": "transactionCurrency"
    }
}

所有逻辑名称均来自运行以下查询:

select
    LogicalName
from 
    NHLPA_MSCRM.dbo.EntityView
where
    BaseTableName = 'paymentbase' -- | invoicebase | transactioncurrencybase
4

1 回答 1

0

摘要:使用OrganizationData.svc/someSeturl 获取现有实体的列表,提供对必要 JSON 结构的完美引用(减去_metaData属性)

所以问题最终变得非常简单。

实体someSet不是问题,正如能够毫无问题地访问所表示的那样http://someUrl.com/someUrl/XRMServices/2011/OrganizationData‌​.svc/someSet

进一步深入研究它是内部逻辑实体(付款、发票、交易货币)。如前所述,这些逻辑名称来自与实体设置页面匹配的数据库(下图)。

在此处输入图像描述

但是,以下所有网址都无法解析:

  • http://someUrl.com/someUrl/XRMServices/2011/OrganizationData‌​.svc/paymentSet
  • http://someUrl.com/someUrl/XRMServices/2011/OrganizationData‌​.svc/invoiceSet
  • http://someUrl.com/someUrl/XRMServices/2011/OrganizationData‌​.svc/transactionCurrencySet

问题是,尽管在您可以找到实体的逻辑名称的所有地方都是小写字母,但第一个字母实际上需要大写,例如:

  • http://someUrl.com/someUrl/XRMServices/2011/OrganizationData‌​.svc/PaymentSet
  • http://someUrl.com/someUrl/XRMServices/2011/OrganizationData‌​.svc/InvoiceSet
  • http://someUrl.com/someUrl/XRMServices/2011/OrganizationData‌​.svc/TransactionCurrencySet

和工作负载:

{
    "paymentid": {
        "Id": "00e3f661-8d28-e321-896e-00155dfd1d05",
        "LogicalName": "Payment"
    },
    "invoiceid": {
        "Id": "00e3f661-8d28-e411-896e-00155dfd1d05",
        "LogicalName": "Invoice"
    },
    "AppliedAmount": 1317.53000,
    "name": "Payment Applied",
    "postingstatus": "Posted",
    "TransactionCurrencyId": {
        "Id": "80870a9b-329e-d421-8a22-00155d025001",
        "LogicalName": "TransactionCurrency"
    }
}
于 2017-08-16T13:03:08.197 回答