diff options
Diffstat (limited to 'mcs/class/System.Web.Services/System.Web.Services.Protocols')
4 files changed, 39 insertions, 20 deletions
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog index 8b0776c0c38..01f02c69e94 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog @@ -1,13 +1,3 @@ -2004-08-25 Lluis Sanchez Gual <lluis@novell.com> - - * HttpSoapWebServiceHandler.cs, WebServiceHandler.cs: Do not assign the - context to the service. It already gets it from HttpContext.Current. - -2004-07-20 Lluis Sanchez Gual <lluis@ximian.com> - - * HttpWebClientProtocol.cs: Add received cookies to cookieContainer when - getting the response, do not wait for the next request to do it. - 2004-06-22 Lluis Sanchez Gual <lluis@ximian.com> * XmlReturnReader.cs, XmlReturnWriter.cs: Generate the serializer with diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs index 6d03900b5b1..eae97b4a743 100755 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSoapWebServiceHandler.cs @@ -335,6 +335,11 @@ namespace System.Web.Services.Protocols private SoapServerMessage Invoke (HttpContext ctx, SoapServerMessage requestMessage) { + WebService wsi = requestMessage.Server as WebService; + if (wsi != null) { + wsi.SetContext (ctx); + } + SoapMethodStubInfo methodInfo = requestMessage.MethodStubInfo; // Assign header values to web service members diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs index 722f1d2a681..3be915cfbc8 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs @@ -45,6 +45,7 @@ namespace System.Web.Services.Protocols { CookieContainer cookieContainer;
IWebProxy proxy;
string userAgent;
+ CookieCollection prevCookies;
#if NET_1_1
bool _unsafeAuthenticated;
@@ -116,25 +117,41 @@ namespace System.Web.Services.Protocols { #region Methods
- internal virtual void CheckForCookies (HttpWebResponse response)
+ internal virtual void AddCookies (Uri uri)
{
- CookieCollection cookies = response.Cookies;
- if (cookieContainer == null || cookies.Count == 0)
+ if (cookieContainer == null)
+ cookieContainer = new CookieContainer ();
+
+ if (prevCookies == null || prevCookies.Count == 0)
return;
CookieCollection coll = cookieContainer.GetCookies (uri);
- foreach (Cookie c in cookies) {
- bool add = true;
- foreach (Cookie prev in coll) {
+ foreach (Cookie prev in prevCookies) {
+ bool dont = false;
+ foreach (Cookie c in coll) {
if (c.Equals (prev)) {
- add = false;
+ dont = true;
break;
}
}
- if (add)
- cookieContainer.Add (c);
+
+ if (dont == false)
+ cookieContainer.Add (prev);
}
}
+
+ internal virtual void CheckForCookies (HttpWebResponse response)
+ {
+ CookieCollection cookies = response.Cookies;
+ if (cookies.Count == 0)
+ return;
+
+ if (prevCookies == null)
+ prevCookies = new CookieCollection ();
+
+ foreach (Cookie c in cookies)
+ prevCookies.Add (c);
+ }
protected override WebRequest GetWebRequest (Uri uri)
{
@@ -147,6 +164,7 @@ namespace System.Web.Services.Protocols { if (clientCertificates != null)
request.ClientCertificates.AddRange (clientCertificates);
+ AddCookies (uri);
request.CookieContainer = cookieContainer;
if (proxy != null)
request.Proxy = proxy;
diff --git a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs index 8727e6f2724..a3b82b8eb1a 100644 --- a/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs +++ b/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandler.cs @@ -78,7 +78,13 @@ namespace System.Web.Services.Protocols protected object CreateServerInstance () { - return Activator.CreateInstance (ServiceType); + object ws = Activator.CreateInstance (ServiceType); + WebService wsi = ws as WebService; + if (wsi != null) { + wsi.SetContext (_context); + } + + return ws; } } } |