NAV OData Web服务PUT不成功

时间:2017-10-28 15:06:02

标签: odata navision microsoft-dynamics-nav

我正在尝试使用Navision OData restful Web服务来执行CRUD操作,但我在PUT操作方面遇到了困难。

{
"@odata.context": "http://192.168.0.10:1148/DynamicsNAV100/ODataV4/$metadata#Collection(NAV.Customer2)",
"@odata.etag": "W/\"JzUyO0VnQUFBQUo3RGpNQU1nQXpBRE1BTWdBeUFESUFNd0F5QURNQU13QXlBRE1BTndBQUFBQUE2OzY1NTU0MDA7Jw==\"",
"No": "32332223233237",
"Name": "Progressive Home Furnishings",
"Search_Name": "PROGRESSIVE HOME FURNISHINGS",
"IC_Partner_Code": "",
"Balance_LCY": 0,
"Balance_Due_LCY": 0,
"Credit_Limit_LCY": 0,
"Blocked": " ",
"Salesperson_Code": "JR",
"Responsibility_Center": "",
"Service_Zone_Code": "X",
"BlockedCustomer": false,
"Document_Sending_Profile": "",
"TotalSales2": 0,
"CustSalesLCY_CustProfit_AdjmtCostLCY": 0,
"AdjCustProfit": 0,
"AdjProfitPct": 0,
"Language_Code": "ENU",
"Last_Date_Modified": "2017-10-28T00:00:00Z",
"Address": "3000 Roosevelt Blvd.",
"Address_2": "",
"Post_Code": "US-IL 61236",
"City": "Chicago",
"Country_Region_Code": "US",
"ShowMap": "Show on Map",
"Primary_Contact_No": "",
"ContactName": "",
"Phone_No": "",
"E_Mail": "",
"Fax_No": "",
"Home_Page": "",
"Bill_to_Customer_No": "",
"VAT_Registration_No": "",
"GLN": "",
"Copy_Sell_to_Addr_to_Qte_From": "Company",
"Gen_Bus_Posting_Group": "EXPORT",
"VAT_Bus_Posting_Group": "EXPORT",
"Customer_Posting_Group": "FOREIGN",
"Invoice_Copies": 0,
"Currency_Code": "USD",
"Customer_Price_Group": "",
"Customer_Disc_Group": "RETAIL",
"Allow_Line_Disc": true,
"Invoice_Disc_Code": "01445544",
"Prices_Including_VAT": false,
"Prepayment_Percent": 0,
"Application_Method": "Manual",
"Partner_Type": " ",
"Payment_Terms_Code": "14 DAYS",
"Payment_Method_Code": "",
"Reminder_Terms_Code": "FOREIGN",
"Fin_Charge_Terms_Code": "2.0 FOR.",
"Cash_Flow_Payment_Terms_Code": "",
"Print_Statements": true,
"Last_Statement_No": 0,
"Block_Payment_Tolerance": false,
"Preferred_Bank_Account_Code": "",
"Location_Code": "YELLOW",
"Combine_Shipments": true,
"Reserve": "Optional",
"Shipping_Advice": "Partial",
"Shipment_Method_Code": "EXW",
"Shipping_Agent_Code": "",
"Shipping_Agent_Service_Code": "",
"Shipping_Time": "",
"Base_Calendar_Code": "",
"Customized_Calendar": "No",
"GetMoneyOwedExpected": 0,
"TotalMoneyOwed": 0,
"CalcCreditLimitLCYExpendedPct": 0,
"Balance_Due": 0,
"Payments_LCY": 0,
"CustomerMgt_AvgDaysToPay_No": 0,
"DaysPaidPastDueDate": 0,
"GetAmountOnPostedInvoices": 0,
"GetAmountOnCrMemo": 0,
"GetAmountOnOutstandingInvoices": 0,
"GetAmountOnOutstandingCrMemos": 0,
"Totals": 0,
"CustInvDiscAmountLCY": 0,
"Global_Dimension_1_Filter": "",
"Global_Dimension_2_Filter": "",
"Currency_Filter": "",
"Date_Filter": "01/01/17..12/31/17",
"ETag": "52;EgAAAAJ7DjMAMgAzADMAMgAyADIAMwAyADMAMwAyADMANwAAAAAA6;6555400;"}

对于这个对象,我打电话给: -

http://192.168.0.10:1148/DynamicsNAV100/ODataV4/Company('testcomp')/Customer2('32332223233237')

with `header if-match as W/"'52;EgAAAAJ7DjMAMgAzADMAMgAyADIAMwAyADMAMwAyADMANwAAAAAA6;6555400;'"`

但我要么

  

请传递并发令牌

  

输入无效base64字符串。

错误的原因是什么?我是Navision的新手

1 个答案:

答案 0 :(得分:0)

您无法在标题etag中发送正确的If_Match 在您的情况下,您需要使用"@odata.etag"值:

"W/\"JzUyO0VnQUFBQUo3RGpNQU1nQXpBRE1BTWdBeUFESUFNd0F5QURNQU13QXlBRE1BTndBQUFBQUE2OzY1NTU0MDA7Jw==\""