Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

multiple webservice calls in one persistent connection

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kplkumar - 12 Jun 2007 21:50 GMT
Hi

I want to make calls to my webservice method multiple times using a
persistent http connection. Is this possible?
John Saunders [MVP] - 13 Jun 2007 04:36 GMT
> Hi
>
> I want to make calls to my webservice method multiple times using a
> persistent http connection. Is this possible?

This can't be done without great effort. Are you sure you need to control
things in this level of detail?
Signature

John Saunders [MVP]

kplkumar - 13 Jun 2007 15:00 GMT
Yeah, I want to do this. I know internet browsers do this, by using
KeepAlive, however I don't know how it could be done from a windows
application calling a webservice.

Can you tell me how??
kplkumar - 13 Jun 2007 15:31 GMT
Yeah, I want to do this. I know internet browsers do this, by using
KeepAlive, however I don't know how it could be done from a windows
application calling a webservice.

In other words, I want to have a persistent connection with the server
and make multiple websrevice calls (requests) and close the
connection.

Can you tell me how??
John Saunders [MVP] - 13 Jun 2007 16:42 GMT
> Yeah, I want to do this. I know internet browsers do this, by using
> KeepAlive, however I don't know how it could be done from a windows
[quoted text clipped - 5 lines]
>
> Can you tell me how??

It's very difficult, it it's possible at all. Internet browsers do it
because they are in complete control of their interaction with the server.
If you want to do the same, you'll either have to do a bunch of very
sophisticated programming (have you ever written code that generates code?),
or you'll have to perform the interaction with the server yourself, and do
without the conveniences that Microsoft offers you.

In particular, you can create your own subclass of
System.Web.Services.Protocols.SoapHttpClientProtocol. You'll have to
override the GetWebRequest method to return an instance of HttpWebRequest
with the KeepAlive property set to true.

But your proxy classes will have to derive from your new subclass. This
means that you won't be able to use Add Web Reference or WSDL.EXE to create
your proxy classes.

Unless, that is, you write a SoapProtocolImporter which will generate proxy
classes based on your own subclass instead of the default
SoapHttpClientProtocol.

I've never done these things, since they are too complicated for most
purposes. It's always been better to let .NET decide whether or not to keep
a connection open, rather than worrying about it myself. Certainly, if you
have determined that there's either a measurable performance impact, or if
you need to do it in order to interact with a server which requires it, then
you have to do it.

And good luck to you. If it works, you should publish the solution.
Signature

John Saunders [MVP]


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.