fix validation of the R2401 rule
authorKonstantin Triger <kostat@mono-cvs.ximian.com>
Sun, 11 Mar 2007 13:31:48 +0000 (13:31 -0000)
committerKonstantin Triger <kostat@mono-cvs.ximian.com>
Sun, 11 Mar 2007 13:31:48 +0000 (13:31 -0000)
svn path=/trunk/mcs/; revision=74064

mcs/class/System.Web.Services/System.Web.Services.Description/BasicProfileChecker.cs
mcs/class/System.Web.Services/System.Web.Services.Description/ChangeLog
mcs/class/System.Web.Services/System.Web.Services.Description/ConformanceChecker.cs
mcs/class/System.Web.Services/System.Web.Services.Description/ProtocolReflector.cs
mcs/class/System.Web.Services/System.Web.Services.Description/WebServicesInteroperability.cs

index 6e667e0044cc7c6a207b72e6910c6fab248fcd85..57c4add63507ad52ab7bdb2718ccec27da63ee85 100644 (file)
@@ -125,14 +125,22 @@ namespace System.Web.Services.Description
                public override void Check (ConformanceCheckContext ctx, Message value)
                {
                }
-               
+
+               public override void Check (ConformanceCheckContext ctx, BindingCollection value) {
+                       foreach (Binding b in value)
+                               foreach (ServiceDescriptionFormatExtension ext in b.Extensions)
+                                       if (ext.GetType () == typeof (SoapBinding))
+                                               return;
+
+                       ctx.ReportRuleViolation (value, BasicProfileRules.R2401);
+               }
+
                public override void Check (ConformanceCheckContext ctx, Binding value)
                {
                        SoapBinding sb = (SoapBinding) value.Extensions.Find (typeof(SoapBinding));
-                       if (sb == null) {
-                               ctx.ReportRuleViolation (value, BasicProfileRules.R2401);
+                       if (sb == null)
                                return;
-                       }
+
                        if (sb.Transport == null || sb.Transport == "") {
                                ctx.ReportRuleViolation (value, BasicProfileRules.R2701);
                                return;
index 27e8308eb555a2fa07fc0a49092e4e57e13aead7..e400de614b399149b56da27ab21a6bbc3a362e31 100644 (file)
@@ -1,3 +1,8 @@
+2007-03-11  Konstantin Triger <kostat@mainsoft.com>
+
+       * ConformanceChecker.cs, WebServicesInteroperability.cs, ProtocolReflector.cs,
+               BasicProfileChecker.cs: fix validation of the R2401 rule.
+
 2007-03-11  Konstantin Triger <kostat@mainsoft.com>
 
        * ServiceDescriptionFormatExtensionCollection.cs: make FindAll(Type)
index 6b8081acefe587e6a5791a19e47786819e2133e3..7ae99481deb981c6e52c9a664df6fb3bd0f49fc8 100644 (file)
@@ -40,6 +40,7 @@ namespace System.Web.Services.Description
                public abstract WsiProfiles Claims { get; }
 
                public virtual void Check (ConformanceCheckContext ctx, Binding value) { }
+               public virtual void Check (ConformanceCheckContext ctx, BindingCollection value) { }
                public virtual void Check (ConformanceCheckContext ctx, MessageBinding value) { }
                public virtual void Check (ConformanceCheckContext ctx, Import value) { }
                public virtual void Check (ConformanceCheckContext ctx, Message value) { }
index 7b54c6b3c2525cc4f0cbafe8683d02468212dc68..f16500eca98a1889ea6d02e401240db0278b19ca 100644 (file)
@@ -285,8 +285,15 @@ namespace System.Web.Services.Description {
                        if (binfo.WebServiceBindingAttribute != null && binfo.WebServiceBindingAttribute.ConformsTo != WsiProfiles.None && String.IsNullOrEmpty (binfo.WebServiceBindingAttribute.Name)) {
                                BasicProfileViolationCollection violations = new BasicProfileViolationCollection ();
                                desc.Types.Schemas.Add (Schemas);
-                               if (!WebServicesInteroperability.CheckConformance (binfo.WebServiceBindingAttribute.ConformsTo, desc, violations))
-                                       throw new InvalidOperationException (violations [0].ToString ());
+                               ServiceDescriptionCollection col = new ServiceDescriptionCollection ();
+                               col.Add (desc);
+                               ConformanceCheckContext ctx = new ConformanceCheckContext (col, violations);
+                               ConformanceChecker[] checkers = WebServicesInteroperability.GetCheckers (binfo.WebServiceBindingAttribute.ConformsTo);
+                               foreach (ConformanceChecker checker in checkers) {
+                                       WebServicesInteroperability.Check (ctx, checker, binding);
+                                       if (violations.Count > 0)
+                                               throw new InvalidOperationException (violations [0].ToString ());
+                               }
                        }
 #endif 
                }
index c5a1015b2a53ed3211ef55d5175c1c2a5ea62613..c25f3349a3e16cb598f1fe5f3aec5b6b90af81c3 100644 (file)
@@ -76,12 +76,33 @@ namespace System.Web.Services.Description
                        return ctx.Violations.Count == 0;
                }
                
-               static ConformanceChecker[] GetCheckers (WsiProfiles claims)
+               internal static ConformanceChecker[] GetCheckers (WsiProfiles claims)
                {
                        if ((claims & WsiProfiles.BasicProfile1_1) != 0)
                                return new ConformanceChecker[] { BasicProfileChecker.Instance };
                        return null;
                }
+
+               internal static void Check (ConformanceCheckContext ctx, ConformanceChecker checker, Binding b)
+               {
+                       checker.Check (ctx, b);
+                       CheckExtensions (ctx, checker, b.Extensions);
+
+                       foreach (OperationBinding oper in b.Operations) {
+                               CheckExtensions (ctx, checker, oper.Extensions);
+
+                               foreach (MessageBinding mb in oper.Faults) {
+                                       checker.Check (ctx, mb);
+                                       CheckExtensions (ctx, checker, mb.Extensions);
+                               }
+
+                               checker.Check (ctx, oper.Input);
+                               CheckExtensions (ctx, checker, oper.Input.Extensions);
+
+                               checker.Check (ctx, oper.Output);
+                               CheckExtensions (ctx, checker, oper.Output.Extensions);
+                       }
+               }
                
                static void Check (ConformanceCheckContext ctx, ConformanceChecker checker, ServiceDescription sd)
                {
@@ -102,27 +123,10 @@ namespace System.Web.Services.Description
                                        CheckExtensions (ctx, checker, p.Extensions);
                                }
                        }
-                       
+
+                       checker.Check (ctx, sd.Bindings);
                        foreach (Binding b in sd.Bindings)
-                       {
-                               checker.Check (ctx, b);
-                               CheckExtensions (ctx, checker, b.Extensions);
-                               
-                               foreach (OperationBinding oper in b.Operations) {
-                                       CheckExtensions (ctx, checker, oper.Extensions);
-                                       
-                                       foreach (MessageBinding mb in oper.Faults) {
-                                               checker.Check (ctx, mb);
-                                               CheckExtensions (ctx, checker, mb.Extensions);
-                                       }
-                                       
-                                       checker.Check (ctx, oper.Input);
-                                       CheckExtensions (ctx, checker, oper.Input.Extensions);
-                                       
-                                       checker.Check (ctx, oper.Output);
-                                       CheckExtensions (ctx, checker, oper.Output.Extensions);
-                               }
-                       }
+                               Check (ctx, checker, b);
                        
                        foreach (PortType pt in sd.PortTypes)
                        {