IDataServiceUpdateProvider needed to update via OData WS
mspace
Member Posts: 3
Hi,
I'm currently experiencing and testing the OData webservice framework for Navision 2013.
I have followed this example (http://msdn.microsoft.com/en-us/library ... 0(v=nav.71).aspx) and code builds fine and
I'm able to retrieve data. Here is my code:
NAV nav = new NAV(new Uri("http://192.168.10.162:7048/DynamicsNAV70/OData/Company('CRONUS International Ltd.')"));
nav.Credentials = CredentialCache.DefaultNetworkCredentials;
// Via LINQ get all customers
var customers = from c in nav.Customer
//where c.Location_Code == "YELLOW"
orderby(c.Name)
select c;
// Write customer list to console
foreach (var c in customers)
{
Console.WriteLine(c.Name);
}
Console.ReadLine();
Console.WriteLine("Printing list of current customers:");
PrintCustomersCalledCust(nav);
Console.WriteLine("Adding new customer.");
Customer newCustomer = new Customer();
newCustomer.Name = "Customer Name";
nav.AddToCustomer(newCustomer);
nav.SaveChanges(); // <== Exception thrown here !!!!
Console.WriteLine("Printing list of current customers:");
PrintCustomersCalledCust(nav);
newCustomer.Name += "Changed";
nav.UpdateObject(newCustomer);
nav.SaveChanges();
Console.WriteLine("Printing list of current customers:");
PrintCustomersCalledCust(nav);
However it seems that the example found at MSDN above has not taken into account that you need an IDataServiceUpdateProvider if you want to post inserts/updates
back to Navision.
I'm getting this error (inner exception):
The data source must implement IDataServiceUpdateProvider to support updates.
Is it really necessary to write a provider in order to update data ? :?
I have found some code examples to implement IDataServiceUpdateProvider (http://blogs.msdn.com/b/alexj/archive/2 ... pdate.aspx),
but I find it difficult to put together all the pieces on the specific pages.
Does someone have a working complete code based on Alex' article ?
Cheers...
Morten
I'm currently experiencing and testing the OData webservice framework for Navision 2013.
I have followed this example (http://msdn.microsoft.com/en-us/library ... 0(v=nav.71).aspx) and code builds fine and
I'm able to retrieve data. Here is my code:
NAV nav = new NAV(new Uri("http://192.168.10.162:7048/DynamicsNAV70/OData/Company('CRONUS International Ltd.')"));
nav.Credentials = CredentialCache.DefaultNetworkCredentials;
// Via LINQ get all customers
var customers = from c in nav.Customer
//where c.Location_Code == "YELLOW"
orderby(c.Name)
select c;
// Write customer list to console
foreach (var c in customers)
{
Console.WriteLine(c.Name);
}
Console.ReadLine();
Console.WriteLine("Printing list of current customers:");
PrintCustomersCalledCust(nav);
Console.WriteLine("Adding new customer.");
Customer newCustomer = new Customer();
newCustomer.Name = "Customer Name";
nav.AddToCustomer(newCustomer);
nav.SaveChanges(); // <== Exception thrown here !!!!
Console.WriteLine("Printing list of current customers:");
PrintCustomersCalledCust(nav);
newCustomer.Name += "Changed";
nav.UpdateObject(newCustomer);
nav.SaveChanges();
Console.WriteLine("Printing list of current customers:");
PrintCustomersCalledCust(nav);
However it seems that the example found at MSDN above has not taken into account that you need an IDataServiceUpdateProvider if you want to post inserts/updates
back to Navision.
I'm getting this error (inner exception):
The data source must implement IDataServiceUpdateProvider to support updates.
Is it really necessary to write a provider in order to update data ? :?
I have found some code examples to implement IDataServiceUpdateProvider (http://blogs.msdn.com/b/alexj/archive/2 ... pdate.aspx),
but I find it difficult to put together all the pieces on the specific pages.
Does someone have a working complete code based on Alex' article ?
Cheers...
Morten
0
Comments
-
Hello,
If your version is 7.0 then OData is not writable. Only from version 7.1... - (NAV 2013 R2).
Try SOAP or upgrade your system to new version.
Regards,
P.0 -
I'm running NAV 2013, not R2 ... that explains the problem with updating data from an OData webservice.
Is there any sample code where I can see how a SOAP webservice (that updates NAV) I can get some inspiration from ?0 -
Sorry for cross-forum posting ( :oops: ), can this thread be useful?* Daniele Rebussi * | * Rebu NAV Diary *0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
