* ProtocolReflector.cs: throw if not conformant, but declared to be.
authorKonstantin Triger <kostat@mono-cvs.ximian.com>
Thu, 1 Feb 2007 12:52:47 +0000 (12:52 -0000)
committerKonstantin Triger <kostat@mono-cvs.ximian.com>
Thu, 1 Feb 2007 12:52:47 +0000 (12:52 -0000)
* TypeStubManager.cs, Methods.cs: refactor BindingInfo contruction to contain
either declared Bindings or a default one.

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

mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog
mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolReflector.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/ChangeLog
mcs/class/System.Web.Services/System.Web.Services.Protocols/Methods.cs
mcs/class/System.Web.Services/System.Web.Services.Protocols/TypeStubManager.cs

index baf6f5275cd4c29c6988db3b5ef2dd31d5ece409..5a16d9fde981664429c01ff10aa75e17d3095a9e 100644 (file)
@@ -1,3 +1,7 @@
+2007-02-01  Konstantin Triger <kostat@mainsoft.com>
+
+       * ProtocolReflector.cs: throw if not conformant, but declared to be.
+
 2007-01-25  Konstantin Triger <kostat@mainsoft.com>
 
        * ServiceDescriptionReflector.cs: describe only supported bindings and
index df3860ba03578d150061d95e1f1a09debf67a07e..93ede0af623ef67fe409f017d847c4b0b5810aaf 100644 (file)
@@ -280,6 +280,14 @@ namespace System.Web.Services.Description {
                                port.Binding = new XmlQualifiedName (binding.Name, binfo.Namespace);
                                service.Ports.Add (port);
                        }
+
+#if NET_2_0
+                       if (binfo.WebServiceBindingAttribute != null && binfo.WebServiceBindingAttribute.ConformsTo != WsiProfiles.None && String.IsNullOrEmpty (binfo.WebServiceBindingAttribute.Name)) {
+                               BasicProfileViolationCollection violations = new BasicProfileViolationCollection ();
+                               if (!WebServicesInteroperability.CheckConformance (binfo.WebServiceBindingAttribute.ConformsTo, desc, violations))
+                                       throw new InvalidOperationException (violations [0].ToString ());
+                       }
+#endif 
                }
 
                bool ImportBindingContent (ServiceDescription desc, TypeStubInfo typeInfo, string url, BindingInfo binfo)
index c3367ab2557acc56eb39f3f3141357bc8da58085..bebdd0b912361e5a25652770f0af42269381d126 100644 (file)
@@ -1,3 +1,8 @@
+2007-02-01  Konstantin Triger <kostat@mainsoft.com>
+
+       * TypeStubManager.cs, Methods.cs: refactor BindingInfo contruction to contain
+               either declared Bindings or a default one.
+
 2007-02-01  Konstantin Triger <kostat@mainsoft.com>
 
        * HttpSimpleWebServiceHandler.cs: Provide better error info.
index b33d9f46dfb27cb796c47a00a3350ed8672b680b..54c82ee3cc92c00767d21e7ba6c1f1ec490b7ce9 100644 (file)
@@ -438,9 +438,7 @@ namespace System.Web.Services.Protocols {
                Hashtable[] header_serializers = new Hashtable [3];
                Hashtable[] header_serializers_byname = new Hashtable [3];
                Hashtable methods_byaction = new Hashtable (); 
-#if NET_2_0
-               WsiProfiles wsi_claims = WsiProfiles.None;
-#endif
+
                // Precomputed
                internal SoapParameterStyle      ParameterStyle;
                internal SoapServiceRoutingStyle RoutingStyle;
@@ -455,32 +453,16 @@ namespace System.Web.Services.Protocols {
                {
                        xmlImporter = new XmlReflectionImporter ();
                        soapImporter = new SoapReflectionImporter ();
-                       
-                       object [] o;
-
-                       o = Type.GetCustomAttributes (typeof (WebServiceBindingAttribute), false);
-                       
+                               
                        if (typeof (SoapHttpClientProtocol).IsAssignableFrom (Type))
                        {
-                               if (o.Length == 0)
+                               if (Bindings.Count == 0 || ((BindingInfo)Bindings[0]).WebServiceBindingAttribute == null)
                                        throw new InvalidOperationException ("WebServiceBindingAttribute is required on proxy class '" + Type + "'.");
-                               if (o.Length > 1)
+                               if (Bindings.Count > 1)
                                        throw new InvalidOperationException ("Only one WebServiceBinding attribute may be specified on type '" + Type + "'.");
-                                       
-                               // Remove the default binding, it is not needed since there is always
-                               // a binding attribute.
-                               Bindings.Clear ();
-#if NET_2_0
-                               WebServiceBindingAttribute wsba = (WebServiceBindingAttribute) o [0];
-                               if (wsba.EmitConformanceClaims)
-                                       wsi_claims = wsba.ConformsTo;
-#endif
                        }
-                               
-                       foreach (WebServiceBindingAttribute at in o)
-                               AddBinding (new BindingInfo (at, LogicalType.WebServiceNamespace));
 
-                       o = Type.GetCustomAttributes (typeof (SoapDocumentServiceAttribute), false);
+                       object [] o = Type.GetCustomAttributes (typeof (SoapDocumentServiceAttribute), false);
                        if (o.Length == 1){
                                SoapDocumentServiceAttribute a = (SoapDocumentServiceAttribute) o [0];
 
@@ -514,12 +496,6 @@ namespace System.Web.Services.Protocols {
                        SoapExtensions = SoapExtension.GetTypeExtensions (Type);
                }
 
-#if NET_2_0
-               public override WsiProfiles WsiClaims {
-                       get { return wsi_claims; }
-               }
-#endif
-
                public override XmlReflectionImporter XmlImporter 
                {
                        get { return xmlImporter; }
index 6690d591491143ec9de5cdea18b1e997156383f3..2eab9d5457c275784c1446c0918f7c9f3c7fc1a9 100644 (file)
@@ -94,14 +94,22 @@ namespace System.Web.Services.Protocols {
                {
                        this.logicalType = logicalTypeInfo;
 
-                       defaultBinding = logicalType.WebServiceName + ProtocolName;
-                       BindingInfo binfo = new BindingInfo (defaultBinding, logicalType.WebServiceNamespace);
-                       Bindings.Add (binfo);
+                       object [] o = Type.GetCustomAttributes (typeof (WebServiceBindingAttribute), false);
+
+                       string defaultBindingName = logicalType.WebServiceName + ProtocolName;
+                       if (o.Length > 0)
+                               foreach (WebServiceBindingAttribute at in o)
+                                       AddBinding (new BindingInfo (at, defaultBindingName, LogicalType.WebServiceNamespace));
+                       else 
+                               AddBinding (new BindingInfo (null, defaultBindingName, logicalType.WebServiceNamespace));
                }
                
 #if NET_2_0
-               public virtual WsiProfiles WsiClaims {
-                       get { return WsiProfiles.None; }
+               public WsiProfiles WsiClaims {
+                       get {
+                               return (((BindingInfo) Bindings [0]).WebServiceBindingAttribute != null) ?
+                                       ((BindingInfo) Bindings [0]).WebServiceBindingAttribute.ConformsTo : WsiProfiles.None;
+                       }
                }
 #endif
                
@@ -225,23 +233,26 @@ namespace System.Web.Services.Protocols {
        
        internal class BindingInfo
        {
-               public BindingInfo (WebServiceBindingAttribute at, string ns)
-               {
-                       Name = at.Name;
-                       Namespace = at.Namespace;
-                       if (Namespace == "") Namespace = ns;
-                       Location = at.Location;
-               }
-               
-               public BindingInfo (string name, string ns)
+               public BindingInfo (WebServiceBindingAttribute at, string name, string ns)
                {
-                       Name = name;
-                       Namespace = ns;
+                       if (at != null) {
+                               Name = at.Name;
+                               Namespace = at.Namespace;
+                               Location = at.Location;
+                               WebServiceBindingAttribute = at;
+                       }
+
+                       if (Name == null || Name.Length == 0)
+                               Name = name;
+
+                       if (Namespace == null || Namespace.Length == 0)
+                               Namespace = ns;
                }
                
-               public string Name;
-               public string Namespace;
-               public string Location;
+               public readonly string Name;
+               public readonly string Namespace;
+               public readonly string Location;
+               public readonly WebServiceBindingAttribute WebServiceBindingAttribute;
        }
 
        //