2002-07-23 Tim Coleman <tim@timcoleman.com>
authorTim Coleman <tim@mono-cvs.ximian.com>
Tue, 23 Jul 2002 21:36:08 +0000 (21:36 -0000)
committerTim Coleman <tim@mono-cvs.ximian.com>
Tue, 23 Jul 2002 21:36:08 +0000 (21:36 -0000)
        * HttpGetClientProtocol.cs:
        * HttpPostClientProtocol.cs
                Implemented the GetWebRequest method
        * HttpSimpleClientProtocol:
                Some implementation of the EndInvoke method
        * HttpWebClientProtocol.cs:
                Set the UserAgent string appropriately
                Implemented the GetWebRequest method
                Implemented the GetWebResponse methods
        * SoapHttpClientProtocol.cs:
                Removed unused fields
                Implemented the GetWebRequest method
        * SoapMessage.cs:
                Implemented the EnsureStage method
        * WebClientProtocol.cs:
                Added a static constructor to construct the cache
                Implemented the Abort method
                Implemented the AddToCache, GetFromCache methods
                Implemented the GetWebRequest method
                Implemented the GetWebResponse methods

svn path=/trunk/mcs/; revision=6095

mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog
mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpGetClientProtocol.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpPostClientProtocol.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleClientProtocol.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpWebClientProtocol.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapHttpClientProtocol.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/SoapMessage.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/WebClientProtocol.cs

index aec91a7647b963a74d5077b224bbd67413003d1f..c9ac7f7f274a05a094db86cc5f28e3d17c003769 100644 (file)
@@ -1,3 +1,25 @@
+2002-07-23  Tim Coleman <tim@timcoleman.com>
+       * HttpGetClientProtocol.cs:
+       * HttpPostClientProtocol.cs
+               Implemented the GetWebRequest method
+       * HttpSimpleClientProtocol:
+               Some implementation of the EndInvoke method
+       * HttpWebClientProtocol.cs:
+               Set the UserAgent string appropriately
+               Implemented the GetWebRequest method
+               Implemented the GetWebResponse methods
+       * SoapHttpClientProtocol.cs:
+               Removed unused fields
+               Implemented the GetWebRequest method
+       * SoapMessage.cs:
+               Implemented the EnsureStage method
+       * WebClientProtocol.cs:
+               Added a static constructor to construct the cache
+               Implemented the Abort method
+               Implemented the AddToCache, GetFromCache methods
+               Implemented the GetWebRequest method
+               Implemented the GetWebResponse methods
+
 2002-07-23  Tim Coleman <tim@timcoleman.com>
        * LogicalMethodTypes.cs:
        * SoapHeaderDirection.cs:
index d57a98bb6a8c6db2cba0aad590c73de913dae0c3..554201746ec9a39647fe31bdfa7128eae1b705c8 100644 (file)
@@ -23,10 +23,13 @@ namespace System.Web.Services.Protocols {
 \r
                #region Methods\r
 \r
-               [MonoTODO]\r
                protected override WebRequest GetWebRequest (Uri uri)\r
                {\r
-                       throw new NotImplementedException ();\r
+                       if (uri == null)\r
+                               throw new InvalidOperationException ("The uri parameter is null.");\r
+                       if (uri.ToString () == String.Empty)\r
+                               throw new InvalidOperationException ("The uri parameter has a length of zero.");\r
+                       return WebRequest.Create (uri);\r
                }\r
 \r
                #endregion // Methods\r
index cf4c75a2bd67aab716a3d81cf14410952f4eb150..ebdc3cdf9a1e2e18165d78c0aadce83e0d767260 100644 (file)
@@ -23,10 +23,13 @@ namespace System.Web.Services.Protocols {
 \r
                #region Methods\r
 \r
-               [MonoTODO]\r
                protected override WebRequest GetWebRequest (Uri uri)\r
                {\r
-                       throw new NotImplementedException ();\r
+                       if (null == uri)\r
+                               throw new InvalidOperationException ("The uri parameter is a null reference.");\r
+                       if (String.Empty == uri.ToString ())\r
+                               throw new InvalidOperationException ("The uri parameter has a length of zero.");\r
+                       return WebRequest.Create (uri);\r
                }\r
 \r
                #endregion // Methods\r
index ab9b515321c29ba86458d2fd9d8b75a0b1d2302a..282739ec4c1a721d59c83b2b5eab3dd3f0b53d7e 100644 (file)
@@ -12,6 +12,12 @@ using System.Web.Services;
 namespace System.Web.Services.Protocols {\r
        public abstract class HttpSimpleClientProtocol : HttpWebClientProtocol {\r
 \r
+               #region Fields\r
+\r
+               IAsyncResult result;\r
+\r
+               #endregion // Fields\r
+\r
                #region Constructors\r
 \r
                protected HttpSimpleClientProtocol () \r
@@ -31,6 +37,8 @@ namespace System.Web.Services.Protocols {
                [MonoTODO]\r
                protected object EndInvoke (IAsyncResult asyncResult)\r
                {\r
+                       if (asyncResult != result)\r
+                               throw new ArgumentException ("asyncResult is not the return value from BeginInvoke");\r
                        throw new NotImplementedException ();\r
                }\r
 \r
index 1a312ad35aed677d8cce41eb1398a6b518b82ebe..a47c7a196940de22f97bba7df41c92b4e726c0e8 100644 (file)
@@ -7,9 +7,11 @@
 // Copyright (C) Tim Coleman, 2002\r
 //\r
 \r
+using System;\r
 using System.ComponentModel;\r
 using System.Net;\r
 using System.Security.Cryptography.X509Certificates;\r
+using System.Threading;\r
 using System.Web.Services;\r
 \r
 namespace System.Web.Services.Protocols {\r
@@ -33,7 +35,7 @@ namespace System.Web.Services.Protocols {
                        clientCertificates = new X509CertificateCollection ();\r
                        cookieContainer = null;\r
                        proxy = null; // FIXME\r
-                       userAgent = "Mono Web Services Client Protocol 1.0.1234.0"; // FIXME\r
+                       userAgent = String.Format ("Mono Web Services Client Protocol {0}", Environment.Version);\r
                }\r
                \r
                #endregion // Constructors\r
@@ -78,22 +80,23 @@ namespace System.Web.Services.Protocols {
 \r
                #region Methods\r
 \r
-               [MonoTODO]\r
                protected override WebRequest GetWebRequest (Uri uri)\r
                {\r
-                       throw new NotImplementedException ();\r
+                       if (null == uri)\r
+                               throw new InvalidOperationException ("The uri parameter is a null reference.");\r
+                       return WebRequest.Create (uri);\r
                }\r
 \r
-               [MonoTODO]\r
                protected override WebResponse GetWebResponse (WebRequest request)\r
                {\r
-                       throw new NotImplementedException ();\r
+                       return request.GetResponse ();\r
                }\r
 \r
-               [MonoTODO]\r
                protected override WebResponse GetWebResponse (WebRequest request, IAsyncResult result)\r
                {\r
-                       throw new NotImplementedException ();\r
+                        IAsyncResult ar = request.BeginGetResponse (null, null);\r
+                        ar.AsyncWaitHandle.WaitOne ();\r
+                        return request.EndGetResponse (result);\r
                }\r
 \r
                #endregion // Methods\r
index 19160d4e77c859fca908f3c4a09053d24c38d6a1..2b17b469e706e8fc32896eb8207d026671909f09 100644 (file)
@@ -8,22 +8,12 @@
 //\r
 \r
 using System.Net;\r
-using System.Security.Cryptography.X509Certificates;\r
+using System.Web;\r
 using System.Web.Services;\r
 \r
 namespace System.Web.Services.Protocols {\r
        public class SoapHttpClientProtocol : HttpWebClientProtocol {\r
 \r
-               #region Fields\r
-\r
-               bool allowAutoRedirect;\r
-               X509CertificateCollection clientCertificates;\r
-               CookieContainer cookieContainer;\r
-               IWebProxy proxy;\r
-               string userAgent;\r
-\r
-               #endregion\r
-\r
                #region Constructors\r
 \r
                public SoapHttpClientProtocol () \r
@@ -52,10 +42,9 @@ namespace System.Web.Services.Protocols {
                        throw new NotImplementedException ();\r
                }\r
 \r
-               [MonoTODO]\r
                protected override WebRequest GetWebRequest (Uri uri)\r
                {\r
-                       throw new NotImplementedException ();\r
+                       return WebRequest.Create (uri);\r
                }\r
 \r
                [MonoTODO]\r
index b0d90440dd0fbd04c0218ddbb9dc79530214b989..91f82d8e1f0975a7e0a324dc2200c85834791075 100644 (file)
@@ -69,10 +69,10 @@ namespace System.Web.Services.Protocols {
                protected abstract void EnsureInStage ();\r
                protected abstract void EnsureOutStage ();\r
 \r
-               [MonoTODO]\r
                protected void EnsureStage (SoapMessageStage stage) \r
                {\r
-                       throw new NotImplementedException ();\r
+                       if ((((int) stage) & ((int) Stage)) == 0)\r
+                               throw new InvalidOperationException ("The current SoapMessageStage is not the asserted stage or stages.");\r
                }\r
 \r
                [MonoTODO]\r
index f6a01973cea38e15e7b14866c707b43e1fa80aab..6a861ee790ca63716fcf696e8102c6e7d9a22ca9 100644 (file)
@@ -7,9 +7,11 @@
 // Copyright (C) Tim Coleman, 2002\r
 //\r
 \r
+using System.Collections.Specialized;\r
 using System.ComponentModel;\r
 using System.Net;\r
 using System.Text;\r
+using System.Threading;\r
 using System.Web.Services;\r
 \r
 namespace System.Web.Services.Protocols {\r
@@ -23,11 +25,18 @@ namespace System.Web.Services.Protocols {
                Encoding requestEncoding;\r
                int timeout;\r
                string url;\r
+               bool abort;\r
+               static HybridDictionary cache;\r
 \r
                #endregion\r
 \r
                #region Constructors\r
 \r
+               static WebClientProtocol ()\r
+               {\r
+                       cache = new HybridDictionary ();\r
+               }\r
+\r
                protected WebClientProtocol () \r
                {\r
                        connectionGroupName = String.Empty;\r
@@ -36,6 +45,7 @@ namespace System.Web.Services.Protocols {
                        requestEncoding = null;\r
                        timeout = 100000;\r
                        url = String.Empty;\r
+                       abort = false;\r
                }\r
                \r
                #endregion // Constructors\r
@@ -88,40 +98,41 @@ namespace System.Web.Services.Protocols {
 \r
                #region Methods\r
 \r
-               [MonoTODO]\r
                public virtual void Abort ()\r
                {\r
-                       throw new NotImplementedException ();\r
+                       abort = true;\r
                }\r
 \r
-               [MonoTODO]\r
                protected static void AddToCache (Type type, object value)\r
                {\r
-                       throw new NotImplementedException ();\r
+                       cache [type] = value;\r
                }\r
 \r
-               [MonoTODO]\r
                protected static object GetFromCache (Type type)\r
                {\r
-                       throw new NotImplementedException ();\r
+                       return cache [type];\r
                }\r
 \r
-               [MonoTODO]\r
                protected virtual WebRequest GetWebRequest (Uri uri)\r
                {\r
-                       throw new NotImplementedException ();\r
+                       return WebRequest.Create (uri);\r
                }\r
 \r
-               [MonoTODO]\r
                protected virtual WebResponse GetWebResponse (WebRequest request)\r
                {\r
-                       throw new NotImplementedException ();\r
+                       if (abort)\r
+                               throw new WebException ("The operation has been aborted.", WebExceptionStatus.RequestCanceled);\r
+                       return request.GetResponse ();\r
                }\r
 \r
-               [MonoTODO]\r
                protected virtual WebResponse GetWebResponse (WebRequest request, IAsyncResult result)\r
                {\r
-                       throw new NotImplementedException ();\r
+                       if (abort)\r
+                               throw new WebException ("The operation has been aborted.", WebExceptionStatus.RequestCanceled);\r
+\r
+                       IAsyncResult ar = request.BeginGetResponse (null, null);\r
+                       ar.AsyncWaitHandle.WaitOne ();\r
+                       return request.EndGetResponse (result);\r
                }\r
 \r
                #endregion // Methods\r