Merge pull request #1155 from steffen-kiess/json-string
[mono.git] / mcs / class / System.Web.Services / System.Web.Services.Description / WebServicesInteroperability.cs
index f022aee601ff169735bfb063e3cd02170c8f8a42..fd3d96138364fb7d5dcae1728efd5248ac127843 100644 (file)
@@ -28,7 +28,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
 
 using System.Collections;
 using System.Xml.Schema;
@@ -41,8 +40,7 @@ namespace System.Web.Services.Description
                {
                }
                
-               [MonoTODO]
-               public static bool CheckConformance (WsiClaims claims, ServiceDescription service, BasicProfileViolationCollection violations)
+               public static bool CheckConformance (WsiProfiles claims, ServiceDescription service, BasicProfileViolationCollection violations)
                {
                        ServiceDescriptionCollection col = new ServiceDescriptionCollection ();
                        col.Add (service);
@@ -50,21 +48,19 @@ namespace System.Web.Services.Description
                        return Check (claims, ctx, col);
                }
 
-               [MonoTODO]
-               public static bool CheckConformance (WsiClaims claims, ServiceDescriptionCollection services, BasicProfileViolationCollection violations)
+               public static bool CheckConformance (WsiProfiles claims, ServiceDescriptionCollection services, BasicProfileViolationCollection violations)
                {
                        ConformanceCheckContext ctx = new ConformanceCheckContext (services, violations);
                        return Check (claims, ctx, services);
                }
 
-               [MonoTODO]
-               public static bool CheckConformance (WsiClaims claims, WebReference webReference, BasicProfileViolationCollection violations)
+               public static bool CheckConformance (WsiProfiles claims, WebReference webReference, BasicProfileViolationCollection violations)
                {
                        ConformanceCheckContext ctx = new ConformanceCheckContext (webReference, violations);
                        return Check (claims, ctx, webReference.Documents.Values);
                }
                
-               static bool Check (WsiClaims claims, ConformanceCheckContext ctx, IEnumerable documents)
+               static bool Check (WsiProfiles claims, ConformanceCheckContext ctx, IEnumerable documents)
                {
                        ConformanceChecker[] checkers = GetCheckers (claims);
                        if (checkers == null) return true;
@@ -79,12 +75,35 @@ namespace System.Web.Services.Description
                        return ctx.Violations.Count == 0;
                }
                
-               static ConformanceChecker[] GetCheckers (WsiClaims claims)
+               internal static ConformanceChecker[] GetCheckers (WsiProfiles claims)
                {
-                       if ((claims & WsiClaims.BP10) != 0)
+                       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);
+
+                               if (oper.Output != null) {
+                                       checker.Check (ctx, oper.Output);
+                                       CheckExtensions (ctx, checker, oper.Output.Extensions);
+                               }
+                       }
+               }
                
                static void Check (ConformanceCheckContext ctx, ConformanceChecker checker, ServiceDescription sd)
                {
@@ -105,27 +124,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)
                        {
@@ -312,10 +314,12 @@ namespace System.Web.Services.Description
                
                static void CheckExtensions (ConformanceCheckContext ctx, ConformanceChecker checker, ServiceDescriptionFormatExtensionCollection extensions)
                {
-                       foreach (ServiceDescriptionFormatExtension ext in extensions)
-                               checker.Check (ctx, ext);
+                       foreach (object o in extensions) {
+                               ServiceDescriptionFormatExtension ext = o as ServiceDescriptionFormatExtension;
+                               if (ext != null)
+                                       checker.Check (ctx, ext);
+                       }
                }
        }
 }
 
-#endif