We are on the same level ;) I try out the Simple Client. I love the smell too. //ZD
MaWeRic
Posts
-
Interacting with a Page Web Service (OData v4) Error -
Interacting with a Page Web Service (OData v4) ErrorThanks Gerry ... yes I dont like it either but client wanted an easy way to code against Microsoft Dynamics. I have been all over that Odata-site and everything work as intended if you do it the raw way, I do like the look of Simple.OData.Client. Maybe try it out. Have you tested it? We are sending in the question to NAV developement team to see if they have any answer to why it dont work with a generator. Thanks for all your help ;)
-
Interacting with a Page Web Service (OData v4) ErrorEverything ok with browsing the service. Filtering etc work like a charm. This is for sure client-issue. I have tried to generate proxyclasses using 2 different tools that state they can produce proxy for OData v4. If I try to use Add Service Reference I get en error like this :
Quote:
The document at the url file:///e:/client.xml was not recognized as a known document type. The error message from each known type may help you fix the problem: - Report from 'XML Schema' is 'The root element of a W3C XML Schema should be and its namespace should be 'http://www.w3.org/2001/XMLSchema'.'. - Report from 'DISCO Document' is 'Discovery document at the URL file:///e:/client.xml could not be found.'. - The document format is not recognized. - Report from 'WSDL Document' is 'There is an error in XML document (2, 2).'. - was not expected. If the service is defined in the current solution, try building the solution and adding the service reference again.
Guess That built in proxyclass generator only handles up to V3? This is what my Schema look like:
Thanks
-
Interacting with a Page Web Service (OData v4) ErrorI am on to it ... Getting back ... //zd
-
Interacting with a Page Web Service (OData v4) ErrorCant see anything in fiddler that draws me into that relation-direction. Its just plain-data. Have to dive deeper into that.
-
Interacting with a Page Web Service (OData v4) ErrorLets see if I can put up a sample thing for you. Yes lazyloading might be a thing just like in EF. Need to turn it off maybe? Thanks // zd
-
Interacting with a Page Web Service (OData v4) ErrorTrying executing .Execute on the object of type :
Global.Microsoft.OData.Client.DataServiceQuery(Of Customer_Card)
Gives me this object and I can see in fiddler that response is received and correct but accoring to error TotalCount is missing: https://postimg.org/image/eyv1hglnj/ However I got the objext I am supposed to. If I try to call .ToList it first makes call to .Execute and then try to create :
System.Collections.Generic.List(Of NAVEntities.Customer_Card)
But it produces an error and I the object looking like this: https://postimg.org/image/e3ewt9b5j/ Full stacktrace is:
Microsoft.OData.Core.ODataException was unhandled
HResult=-2146233079
Message=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.
Source=Microsoft.OData.Core
StackTrace:
at Microsoft.OData.Core.ODataFeedAndEntryTypeContext.ValidateAndReturn[T](T value)
at Microsoft.OData.Core.ODataFeedAndEntryTypeContext.get_NavigationSourceName()
at Microsoft.OData.Core.Evaluation.ODataConventionalEntityMetadataBuilder.ComputeId()
at Microsoft.OData.Core.Evaluation.ODataConventionalEntityMetadataBuilder.ComputeAndCacheId()
at Microsoft.OData.Core.Evaluation.ODataConventionalEntityMetadataBuilder.GetId()
at Microsoft.OData.Client.Materialization.MaterializerEntry.UpdateEntityDescriptor()
at Microsoft.OData.Client.Materialization.FeedAndEntryMaterializerAdapter.ReadEntryCore()
at Microsoft.OData.Client.Materialization.FeedAndEntryMaterializerAdapter.TryReadEntry(MaterializerEntry& entry)
at Microsoft.OData.Client.Materialization.FeedAndEntryMaterializerAdapter.d__0.MoveNext()
at Microsoft.OData.Client.Materialization.FeedAndEntryMaterializerAdapter.Read()
at Microsoft.OData.Client.Materialization.ODataReaderEntityMaterializer.ReadNextFeedOrEntry()
at Microsoft.OData.Client.Materialization.ODataEntityMaterializer.ReadImplementation()
at Microsoft.OData.Client.MaterializeAtom.MoveNextInternal()
at Microsoft.OData.Client.MaterializeAtom.MoveNext()
at System.Linq.Enumerable.d__94`1.MoveNext()
at System.Collections.Generic -
Interacting with a Page Web Service (OData v4) ErrorThe object returned is :
Microsoft.OData.Client.DataServiceQuery(Of Customer_Card)
The object created by the Client generator. I need to call .Execute or something else with collection to make it execute the query. If I do that I get :
Microsoft.OData.Client.QueryOperationResponse(Of Customer\_Card)
The execution seem ok. Problem is when I start enumerating through the list that shold have been produced. I can clearly see in fiddler that result comming back to me is ok. Something is happening on clientside. Maybe the call itself to the service is doing something wierd. But why should it do that when it works on the query for Company. Can this has to do with child/relations spec maybe? Thanks ZD
-
Interacting with a Page Web Service (OData v4) ErrorWill take a look into it ... Getting back to you!
-
Interacting with a Page Web Service (OData v4) ErrorIt is failing on the .ToList part ... Its very wierd. Tried that thing but same. And wierdest of all why is it trying to write a JSON-response? Sounds more like something from server?
-
Interacting with a Page Web Service (OData v4) ErrorHi! 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:
NAVCient = new NAVEntities.NAV(new Uri("myhost/.../ODataV4"));
NAVCient.Credentials = new Net.NetworkCredential("usr", "psw");
List 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:
NAVCient = new NAVEntities.NAV(new Uri("myhost/.../ODataV4/Company('MyTest')"));
NAVCient.Credentials = new Net.NetworkCredential("usr", "psw");
List 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:
-
UDP communication and CRC16 calculationsHeyyThanks! If I try this calculator : [^] I try calculate : 05A0 Looking at "CRC-CCITT (XModem)" the result is correct but backwards. Why is that? Edit: I guess I should send it as 1F4A as documentation says? I am totally new to this with UDP and sending bytes. But I gess id I dont ask I dont learn :) I goggled Little and big endians and I guess little endians means sending reversed order? //Henrik
-
UDP communication and CRC16 calculationsI am trying to communicate with a TurnStile but cant understand how that build their commands. This is example of command: [^] The command is 0xA005 as it states as CMD but it shows as 05 A0 ... confuses me. Is that really correct? Shoudn't it be A0 05? Any reason for doing it backwards? CRC16 calculation of command should be "1F 4A" according to that example but I have tried to calculate for that command I cant get same result. Anyone can help me with that CRC15 calculation? Regards // Maw
-
Undo changes to context when using EntityFramework 4.0/4.1I have Invoice entity wich I change and then add InvoiceRows and then I want to cancel the whole operation. What is the easiest way of doing this? I can use Context.refresh() to get a fresh copy of my Entity but is this really the way to do it? //h
-
How do I read this XML file?Yep I had ;D Crazy But it worked ... Thanks all ... /m
-
How do I read this XML file?Wonderful .. Now lets say I want to go 1 steå under name You select the Family but under name I have firstname and lastname ... Can I do a SingleNodeSelect 2 steps down in the structure like "ot:name/firstname"? //h
-
How do I read this XML file?I used the link and could get all my orders suing namespace. Under each namespace there is a lot of elements like and others. I loop through my orders without problems. But how do I select a child to a node using namespace? releative XPath in other words. My code now look like this:
'Objects() Dim XDoc As New XmlDocument Dim Orders As XmlNodeList 'Try to read doc XDoc.Load(ImportFile) 'Create an XmlNamespaceManager for resolving namespaces. Dim XN As XmlNamespaceManager = New XmlNamespaceManager(XDoc.NameTable) XN.AddNamespace("Order", "http://www.opentrans.org/XMLSchema/1.0") 'Get Orders from XML Orders = XDoc.SelectNodes("//Order:ORDER", XN) For Each Order As XmlNode In Orders dim MyOrderId as string = Orders.SelectSingleNode("ORDER\_ID",XN).innerText next
That doesn't work if I want the OrderID. If I use
Order.SelectSingleNode("/Order:ORDER_DATE", XN)
I get the first OrderID each time. Ideas? //M
-
How do I read this XML-file?It was provided that way ... I am just truing to read out the data in each name node. Right now I just use XMLdocument as seen in my code and by NodeSelect. As answered in the other forum I need to use namespace in my select to. Thanks for help .. //M
-
How do I read this XML-file?I have an XML file looking like this (just an example):
<?xml version="1.0" encoding="UTF-8" ?> <family> <name xmlns="http://www.opentrans.org/XMLSchema/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" type="standard"> <firstname>Tom</firstname> <lastname>Smith</lastname> </name> <name xmlns="http://www.opentrans.org/XMLSchema/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" type="standard"> <firstname>Dale</firstname> <lastname>Smith</lastname> </name> </family>
I can read up the document as a XMLDocument and navigate through SelctNodes if the Namespace attribute is not present. I have understood that I need to specify some kind of namespace using a namespace manager. This is my code so far :'Create objcts Dim m_xmld As XmlDocument Dim m_nodelist As XmlNodeList Dim m_node As XmlNode 'Create the XML Document m_xmld = New XmlDocument() 'Load the Xml file m_xmld.Load("D:\family.xml") 'Get the list of name nodes m_nodelist = m_xmld.SelectNodes("/family/name") 'How many nodes msgbox(m_nodelist.count)
Anyone can fill in the missing parts for me? C# or VB.NET .. doesn't matter Regards // M -
How do I read this XML file?I have an XML file looking like this (just an example):
<?xml version="1.0" encoding="UTF-8" ?> <family> <name xmlns="http://www.opentrans.org/XMLSchema/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" type="standard"> <firstname>Tom</firstname> <lastname>Smith</lastname> </name> <name xmlns="http://www.opentrans.org/XMLSchema/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" type="standard"> <firstname>Dale</firstname> <lastname>Smith</lastname> </name> </family>
I can read up the document as a XMLDocument and navigate through SelctNodes if the Namespace attribute is not present. I have understood that I need to specify some kind of namespace using a namespace manager. This is my code so far :'Create objcts Dim m_xmld As XmlDocument Dim m_nodelist As XmlNodeList Dim m_node As XmlNode 'Create the XML Document m_xmld = New XmlDocument() 'Load the Xml file m_xmld.Load("D:\family.xml") 'Get the list of name nodes m_nodelist = m_xmld.SelectNodes("/family/name") 'How many nodes msgbox(m_nodelist.count)
Anyone can fill in the missing parts for me? C# or VB.NET .. doesn't matter :D Regards // M