Replace low level web-service reference call transport with custom one
Posted
by hoodoos
on Stack Overflow
See other posts from Stack Overflow
or by hoodoos
Published on 2010-03-14T08:56:57Z
Indexed on
2010/03/14
9:05 UTC
Read the original article
Hit count: 306
I'm not sure if title sounds right actually, so I will give more explanation here. I will begin from very beginning :)
I'm using c# and .net for my development.
I have an application that makes requests to some soap web-service and for each user request it produces 3 to 10 requests for web-service, they should all run async to finish in one time, so I use Async method of the web-service generated reference and then wait for result on callback. But it seems like it starts a thread (or takes it from pool) for every async call I make, so if I have 10 clients I got to spawn 30 to 100 threads and it sounds terrible even for my 16 cores server :) So i wanted to replace low level transport implementation with my own which uses non-blocking sockets and can handle at least 50 sockets run parallel in one thread with not much overhead. But I actually dunno where to put my override best.
I analyzed System.Web.Services.Protocols.SoapHttpClientProtocol
class and see that it has some GetWebRequest method which I actually could use. If only I could somehow interupt the object it creates and get a http request with all headers and body from there and then send it with my own sockets..
Any ideas what approach to use? Or maybe there's something built in the framework I can use?
© Stack Overflow or respective owner