2017-10-28 103 views
0

我想使用Navision OData寧靜的Web服務來執行CRUD操作,但我在PUT操作中遇到困難。NAV OData Web服務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的新手

回答

0

您不會在標頭If_Match中發送正確的etag
您需要使用"@odata.etag"價值,你的情況:

"W/\"JzUyO0VnQUFBQUo3RGpNQU1nQXpBRE1BTWdBeUFESUFNd0F5QURNQU13QXlBRE1BTndBQUFBQUE2OzY1NTU0MDA7Jw==\""