|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Webservice proxy and overrideI 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 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 Show quote "patrick.san***@gmail.com" wrote: > 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 > > |
|||||||||||||||||||||||