Click here to Skip to main content
15,850,753 members
Home / Discussions / C#
   

C#

 
GeneralRe: A Better Way? Pin
Kevin Marois5-Jan-17 5:32
professionalKevin Marois5-Jan-17 5:32 
GeneralRe: A Better Way? Pin
Eddy Vluggen5-Jan-17 5:36
professionalEddy Vluggen5-Jan-17 5:36 
GeneralRe: A Better Way? Pin
Pete O'Hanlon5-Jan-17 7:00
subeditorPete O'Hanlon5-Jan-17 7:00 
AnswerRe: A Better Way? Pin
#realJSOP6-Jan-17 5:45
mve#realJSOP6-Jan-17 5:45 
GeneralRe: A Better Way? Pin
Kevin Marois6-Jan-17 5:47
professionalKevin Marois6-Jan-17 5:47 
QuestionC#.net:Listen to event fire on app minimize to tray Pin
hassaan mustafa4-Jan-17 4:07
hassaan mustafa4-Jan-17 4:07 
AnswerRe: C#.net:Listen to event fire on app minimize to tray Pin
Eddy Vluggen4-Jan-17 8:05
professionalEddy Vluggen4-Jan-17 8:05 
QuestionInteracting with a Page Web Service (OData v4) Error Pin
MaWeRic3-Jan-17 23:03
MaWeRic3-Jan-17 23:03 
Hi!
I have published a Microsoft Dynamics NAV page as an OData web service V4.
I used Odata v4 Client Code Genrator ver 2.4.0 to create the Client side proxy classes for my C# project.
When I make a simple call to "myhost/.../Company" everything works like a charm using simple code like this:

C#
NAVCient = new NAVEntities.NAV(new Uri("myhost/.../ODataV4"));
NAVCient.Credentials = new Net.NetworkCredential("usr", "psw");
List<NAVEntities.Company> company = NAVCient.Company.ToList;


I get my list of available Companies. Now I want to get the CustomerCards for my selected Company. I do like this:

C#
NAVCient = new NAVEntities.NAV(new Uri("myhost/.../ODataV4/Company('MyTest')")); 
NAVCient.Credentials = new Net.NetworkCredential("usr", "psw"); 
List<NAVEntities.Customer_Card> Customers = NAVCient.Customer_Card.ToList;


The uri genrated is correct and I can see the response comming back correct using fiddler with all my data. Code gets an exception trying to parse the information. At first i thought the backend had some issues but clearly its the client producing this error bec in fiddler I can see my result and nothing else as a response from server :

"An unhandled exception of type 'Microsoft.OData.Core.ODataException' occurred in Microsoft.OData.Core.dll
Additional information: When writing a JSON response, a user model must be specified and the entity set and entity type must be passed to the ODataMessageWriter.CreateODataEntryWriter method or the ODataFeedAndEntrySerializationInfo must be set on the ODataEntry or ODataFeed that is being written."


Any suggestions/advice?
I have tried other sources and they work as it seem.
Thanks for your help
// henrik
Tags:
AnswerRe: Interacting with a Page Web Service (OData v4) Error Pin
Gerry Schmitz4-Jan-17 10:23
mveGerry Schmitz4-Jan-17 10:23 
GeneralRe: Interacting with a Page Web Service (OData v4) Error Pin
MaWeRic4-Jan-17 10:27
MaWeRic4-Jan-17 10:27 
GeneralRe: Interacting with a Page Web Service (OData v4) Error Pin
Gerry Schmitz4-Jan-17 10:31
mveGerry Schmitz4-Jan-17 10:31 
GeneralRe: Interacting with a Page Web Service (OData v4) Error Pin
MaWeRic4-Jan-17 12:01
MaWeRic4-Jan-17 12:01 
GeneralRe: Interacting with a Page Web Service (OData v4) Error Pin
MaWeRic4-Jan-17 12:43
MaWeRic4-Jan-17 12:43 
GeneralRe: Interacting with a Page Web Service (OData v4) Error Pin
Gerry Schmitz4-Jan-17 13:31
mveGerry Schmitz4-Jan-17 13:31 
GeneralRe: Interacting with a Page Web Service (OData v4) Error Pin
MaWeRic4-Jan-17 20:13
MaWeRic4-Jan-17 20:13 
GeneralRe: Interacting with a Page Web Service (OData v4) Error Pin
Gerry Schmitz4-Jan-17 20:47
mveGerry Schmitz4-Jan-17 20:47 
GeneralRe: Interacting with a Page Web Service (OData v4) Error Pin
MaWeRic4-Jan-17 21:10
MaWeRic4-Jan-17 21:10 
GeneralRe: Interacting with a Page Web Service (OData v4) Error Pin
MaWeRic4-Jan-17 21:13
MaWeRic4-Jan-17 21:13 
GeneralRe: Interacting with a Page Web Service (OData v4) Error Pin
zequion5-Jan-17 0:08
professionalzequion5-Jan-17 0:08 
GeneralRe: Interacting with a Page Web Service (OData v4) Error Pin
Pete O'Hanlon5-Jan-17 0:09
subeditorPete O'Hanlon5-Jan-17 0:09 
GeneralRe: Interacting with a Page Web Service (OData v4) Error Pin
Gerry Schmitz4-Jan-17 22:19
mveGerry Schmitz4-Jan-17 22:19 
GeneralRe: Interacting with a Page Web Service (OData v4) Error Pin
MaWeRic5-Jan-17 0:12
MaWeRic5-Jan-17 0:12 
GeneralRe: Interacting with a Page Web Service (OData v4) Error Pin
MaWeRic5-Jan-17 2:00
MaWeRic5-Jan-17 2:00 
GeneralRe: Interacting with a Page Web Service (OData v4) Error Pin
Gerry Schmitz5-Jan-17 6:23
mveGerry Schmitz5-Jan-17 6:23 
GeneralRe: Interacting with a Page Web Service (OData v4) Error Pin
MaWeRic5-Jan-17 9:00
MaWeRic5-Jan-17 9:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.