Webservice proxy and override

P

patrick.sannes

Hi all,

I got the following problem. When I add a webref to a project it
generates (somewhere in the darsksides of the solution) a proxyclass.
If you follow the inheritance tree you get the following tree:
Component
WebClientProtocol
HttpWebClientProtocol
SoapHttpClientProtocol
MyProxy

In MyProxy I have to insert the following code to turn off keepalive
(that is becouse our current CICS version on our mainframe)
protected override System.Net.WebRequest GetWebRequest(Uri uri)
{
HttpWebRequest request = new
(HttpWebRequest)HttpWebRequest.Create(uri);
request.KeepAlive = false;
return request;
}

My main problem is that I have around 200 Webreferences for our
webapplication (old cobol programs). If I want to add the code to the
reference.cs (under the webreference) it will be destroyed when I do a
regenerate. If I generate a proxy with wsdl.exe, I have a lot of manual
work, that maybe have to be changed when we get a new CICS version.
I was hoping I could do it with the decorator pattern, but it is not
the one.

I hope someone have some suggestions to resolve this problem in a nice
way.

Regards,
Patrick
 
G

Guest

Hi Patrick

There might be a workaround that, while not exactly "nice", could avoid the
need to recode when a reference is refreshed. Try setting the
ConnectionGroupName of your WebRequest object to some random string
(System.Guid.NewGuid().ToString() ought to do it!) before sending the request.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top