Im trying to add the ability to my web api to batch calls (possibly in one transaction). My idea was to create a specific batch controller that would receive a number of API calls (in json, including Url, Http method, params) and then it would subsequently
perform each api calls then return the batch result. My first try above resulted in Resource not found problem which I suspect is related to routes not working. In that setup I would instantiate an HttpServer (using GlobalConfiguration.Configuration) and fire
of calls to SubmitRequestAsync.
Next option I tried was to use a DelegatingHandler and try to execute the calls in there. In this setup I'm getting a Method Not Allowed. The funny thing is if I let the batch call continue like a normal call to my previous btach controller action (emptied
ofc) and try that multiple times, the controller action only gets called once.
I'm guessing that MVC is caching/storing some request specific data in the bowels of the HttpRequestMessage, but I can't put my finger on it.
Has anyone else been down this road before or know of things to look out for when mimicking an request on the server?
bccoltof
Member
10 Points
5 Posts
Batching Web API calls
May 24, 2012 12:56 PM|LINK
Hi all,
Im trying to add the ability to my web api to batch calls (possibly in one transaction). My idea was to create a specific batch controller that would receive a number of API calls (in json, including Url, Http method, params) and then it would subsequently perform each api calls then return the batch result. My first try above resulted in Resource not found problem which I suspect is related to routes not working. In that setup I would instantiate an HttpServer (using GlobalConfiguration.Configuration) and fire of calls to SubmitRequestAsync.
Next option I tried was to use a DelegatingHandler and try to execute the calls in there. In this setup I'm getting a Method Not Allowed. The funny thing is if I let the batch call continue like a normal call to my previous btach controller action (emptied ofc) and try that multiple times, the controller action only gets called once.
I'm guessing that MVC is caching/storing some request specific data in the bowels of the HttpRequestMessage, but I can't put my finger on it.
Has anyone else been down this road before or know of things to look out for when mimicking an request on the server?
batch web