Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ODataMediaTypeFormatter usage by HttpClient #39

Closed
LianwMS opened this issue Jan 12, 2015 · 1 comment
Closed

Support ODataMediaTypeFormatter usage by HttpClient #39

LianwMS opened this issue Jan 12, 2015 · 1 comment

Comments

@LianwMS
Copy link
Contributor

LianwMS commented Jan 12, 2015

My company expects to implement IIS hosted Web APIs that run on app servers.
These will be called by IIS hosted web applications that run on web servers.

We can therefore use ApiControllers on the app servers and call them from
HttpClient from the web servers. I like this programming model, where we use
the same MediaTypeFormatter and extensibility points at both ends of the wire.

We expect to use EntitySetController endpoints wherever we can, for general
CRUD operations, using the JSON light format. Then fall back to ApiControllers
if we have to - for operations like IN queries that OData doesn't support.

Ideally I'd like to be able to the following. These may need to use different
wire formats (maybe JSON.Net and JSON light). However, I don't want to have to
use a DataServiceContext to call EntitySetController, since supporting two
entirely different client side programming models adds a lot of work.

  • Use the HttpClient to talk to an ApiController
  • Use the HttpClient to talk to an EntitySetController

I think I'm right in saying that the second case requires the client to use
the ODataMediaTypeFormatter, and the client needs to provide an IEdmModel via
the HttpRequestMessage.SetEdmModel method. However, I've been unable to get
this to work, with various formatter / serialization problems.

If this supported currently, and if so can anyone point me to some sample
code? Any help appreciated.

Work Item Details

Original CodePlex Issue: Issue 1140
Status: Proposed
Reason Closed: Unassigned
Assigned to: Unassigned
Reported on: Jul 17, 2013 at 1:14 PM
Reported by: GaryArcher
Updated on: Feb 20, 2014 at 3:18 AM
Updated by: Seawerst

@LianwMS
Copy link
Contributor Author

LianwMS commented Jan 12, 2015

On 2013-07-26 06:50:19 UTC, eilonlipton commented:

Hi Gary, this is something we'd like to look into in a future version. In the meantime we recommend using the WCF Data Services client to talk to the Web API OData service. An alternative is to use ODataLib directly, which in the end is what Web API OData
uses to implement the OData functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants