Open mladenb opened 5 years ago
I'm trying to call unbound function call.
await _apiService.Container.Unbound().Function<EntityName>("GetListFunction").Set(new { WorkOrder = workOrder}).ExecuteAsEnumerableAsync();
API is working fine.
/api/GetListFunction(WorkOrder = '12345678')
However, calling the function from client app throws an exception.
When writing a JSON response, a user model must be specified and the entity set and entity type must be passed to the ODataMessageWriter.CreateODataResourceWriter method or the ODataResourceSerializationInfo must be set on the ODataResource or ODataResourceSet that is being written.
at Microsoft.OData.ODataResourceTypeContext.ValidateAndReturn[T] (T value) [0x0001a] in
I am getting the same error using an unbound action and ExecuteAsSingleAsync. The action works but it generates the same exception. In my use case, I don't care about the action response at all, I ended up using an HTTP client and make the call myself.
Also getting this.
Hi,
I have an issue calling a simple function, using simple.odata.client library. In short, on the client side, I'm using an ASP.NET MVC web app, which calls our ASP.NET OData API, using the following code:
which results in the API returning the 200 OK result (inspected with Fiddler) with a proper collection in the response body, but the simple.odata.client raises an exception:
with a stack trace:
The server side code (OData API) for the function is this:
Although when using the similar function, which returns a single entity as a result, instead of a collection, then everything works. So, on the client-side:
On the server side:
The bottom line is, I can make the call to the function which returns a single entity, but it appears I can't call a function that returns a collection of entities.
The strange thing is that, looking into the Fiddler, I can see the server (api) responded with 200 OK, and returned the proper collection, but the simple.odata.client seems to have difficulties parsing it.
If useful, this is the response from the api server:
Any help would be highly appreciated. Thanks.