public static bool CheckConformance (WsiProfiles claims, ServiceDescription service, BasicProfileViolationCollection violations)
		{
			ServiceDescriptionCollection col = new ServiceDescriptionCollection ();
			col.Add (service);
			ConformanceCheckContext ctx = new ConformanceCheckContext (col, violations);
			return Check (claims, ctx, col);
		}
Ejemplo n.º 2
0
        public static bool CheckConformance(WsiProfiles claims, WebReference webReference, BasicProfileViolationCollection violations)
        {
            if ((claims & WsiProfiles.BasicProfile1_1) == WsiProfiles.None)
            {
                return(true);
            }
            if (webReference == null)
            {
                return(true);
            }
            if (violations == null)
            {
                throw new ArgumentNullException("violations");
            }
            XmlSchemas schemas = new XmlSchemas();
            ServiceDescriptionCollection descriptions = new ServiceDescriptionCollection();
            StringCollection             warnings     = new StringCollection();

            foreach (DictionaryEntry entry in webReference.Documents)
            {
                ServiceDescriptionImporter.AddDocument((string)entry.Key, entry.Value, schemas, descriptions, warnings);
            }
            int count = violations.Count;

            AnalyzeDescription(descriptions, violations);
            return(count == violations.Count);
        }
Ejemplo n.º 3
0
        public static bool CheckConformance(WsiProfiles claims, ServiceDescription service, BasicProfileViolationCollection violations)
        {
            ServiceDescriptionCollection col = new ServiceDescriptionCollection();

            col.Add(service);
            ConformanceCheckContext ctx = new ConformanceCheckContext(col, violations);

            return(Check(claims, ctx, col));
        }
Ejemplo n.º 4
0
 internal static ConformanceChecker[] GetCheckers(WsiProfiles claims)
 {
     if ((claims & WsiProfiles.BasicProfile1_1) != 0)
     {
         return new ConformanceChecker[] { BasicProfileChecker.Instance }
     }
     ;
     return(null);
 }
 private static CustomAttributeBuilder CreateWebServiceBindingAttribute(WsiProfiles wsiProfile)
 {
     ReflectionUtils.CustomAttributeBuilderBuilder cabb =
         new ReflectionUtils.CustomAttributeBuilderBuilder(typeof(WebServiceBindingAttribute));
     if (wsiProfile == WsiProfiles.BasicProfile1_1)
     {
         cabb.AddPropertyValue("ConformsTo", wsiProfile);
     }
     return(cabb.Build());
 }
Ejemplo n.º 6
0
        public static bool CheckConformance(WsiProfiles claims, ServiceDescription description, BasicProfileViolationCollection violations)
        {
            if (description == null)
            {
                throw new ArgumentNullException("description");
            }
            ServiceDescriptionCollection descriptions = new ServiceDescriptionCollection();

            descriptions.Add(description);
            return(CheckConformance(claims, descriptions, violations));
        }
Ejemplo n.º 7
0
 private void ImportReflectedMethod(SoapReflectedMethod soapMethod)
 {
     this.action                = soapMethod.action;
     this.extensions            = soapMethod.extensions;
     this.extensionInitializers = SoapReflectedExtension.GetInitializers(this.methodInfo, soapMethod.extensions);
     this.oneWay                = soapMethod.oneWay;
     this.rpc        = soapMethod.rpc;
     this.use        = soapMethod.use;
     this.paramStyle = soapMethod.paramStyle;
     this.wsiClaims  = soapMethod.binding == null ? WsiProfiles.None : soapMethod.binding.ConformsTo;
 }
		static bool Check (WsiProfiles claims, ConformanceCheckContext ctx, IEnumerable documents)
		{
			ConformanceChecker[] checkers = GetCheckers (claims);
			if (checkers == null) return true;
			
			foreach (object doc in documents) {
				if (!(doc is ServiceDescription)) continue;
				
				foreach (ConformanceChecker c in checkers)
					Check (ctx, c, (ServiceDescription)doc);
			}
				
			return ctx.Violations.Count == 0;
		}
Ejemplo n.º 9
0
        public static bool CheckConformance(WsiProfiles claims, ServiceDescriptionCollection descriptions, BasicProfileViolationCollection violations)
        {
            if ((claims & WsiProfiles.BasicProfile1_1) == WsiProfiles.None)
            {
                return(true);
            }
            if (descriptions == null)
            {
                throw new ArgumentNullException("descriptions");
            }
            if (violations == null)
            {
                throw new ArgumentNullException("violations");
            }
            int count = violations.Count;

            AnalyzeDescription(descriptions, violations);
            return(count == violations.Count);
        }
 internal static void AddConformanceClaims(XmlElement documentation, WsiProfiles claims)
 {
     claims &= WsiProfiles.BasicProfile1_1;
     if (claims != WsiProfiles.None)
     {
         WsiProfiles conformanceClaims = GetConformanceClaims(documentation);
         claims &= ~conformanceClaims;
         if (claims != WsiProfiles.None)
         {
             XmlDocument ownerDocument = documentation.OwnerDocument;
             if ((claims & WsiProfiles.BasicProfile1_1) != WsiProfiles.None)
             {
                 XmlElement newChild = ownerDocument.CreateElement("wsi", "Claim", "http://ws-i.org/schemas/conformanceClaim/");
                 newChild.SetAttribute("conformsTo", "http://ws-i.org/profiles/basic/1.1");
                 documentation.InsertBefore(newChild, null);
             }
         }
     }
 }
 internal static void AddConformanceClaims(XmlElement documentation, WsiProfiles claims)
 {
     claims &= WsiProfiles.BasicProfile1_1;
     if (claims != WsiProfiles.None)
     {
         WsiProfiles conformanceClaims = GetConformanceClaims(documentation);
         claims &= ~conformanceClaims;
         if (claims != WsiProfiles.None)
         {
             XmlDocument ownerDocument = documentation.OwnerDocument;
             if ((claims & WsiProfiles.BasicProfile1_1) != WsiProfiles.None)
             {
                 XmlElement newChild = ownerDocument.CreateElement("wsi", "Claim", "http://ws-i.org/schemas/conformanceClaim/");
                 newChild.SetAttribute("conformsTo", "http://ws-i.org/profiles/basic/1.1");
                 documentation.InsertBefore(newChild, null);
             }
         }
     }
 }
 internal BasicProfileViolation(string normativeStatement, string element)
 {
     this.claims = WsiProfiles.BasicProfile1_1;
     this.normativeStatement = normativeStatement;
     int index = normativeStatement.IndexOf(',');
     if (index >= 0)
     {
         normativeStatement = normativeStatement.Substring(0, index);
     }
     this.details = Res.GetString("HelpGeneratorServiceConformance" + normativeStatement);
     this.recommendation = Res.GetString("HelpGeneratorServiceConformance" + normativeStatement + "_r");
     if (element != null)
     {
         this.Elements.Add(element);
     }
     if (this.normativeStatement == "Rxxxx")
     {
         this.normativeStatement = Res.GetString("Rxxxx");
     }
 }
Ejemplo n.º 13
0
        internal BasicProfileViolation(string normativeStatement, string element)
        {
            this.claims             = WsiProfiles.BasicProfile1_1;
            this.normativeStatement = normativeStatement;
            int index = normativeStatement.IndexOf(',');

            if (index >= 0)
            {
                normativeStatement = normativeStatement.Substring(0, index);
            }
            this.details        = Res.GetString("HelpGeneratorServiceConformance" + normativeStatement);
            this.recommendation = Res.GetString("HelpGeneratorServiceConformance" + normativeStatement + "_r");
            if (element != null)
            {
                this.Elements.Add(element);
            }
            if (this.normativeStatement == "Rxxxx")
            {
                this.normativeStatement = Res.GetString("Rxxxx");
            }
        }
Ejemplo n.º 14
0
        static bool Check(WsiProfiles claims, ConformanceCheckContext ctx, IEnumerable documents)
        {
            ConformanceChecker[] checkers = GetCheckers(claims);
            if (checkers == null)
            {
                return(true);
            }

            foreach (object doc in documents)
            {
                if (!(doc is ServiceDescription))
                {
                    continue;
                }

                foreach (ConformanceChecker c in checkers)
                {
                    Check(ctx, c, (ServiceDescription)doc);
                }
            }

            return(ctx.Violations.Count == 0);
        }
        internal static WsiProfiles GetConformanceClaims(XmlElement documentation)
        {
            XmlNode nextSibling;

            if (documentation == null)
            {
                return(WsiProfiles.None);
            }
            WsiProfiles none = WsiProfiles.None;

            for (XmlNode node = documentation.FirstChild; node != null; node = nextSibling)
            {
                nextSibling = node.NextSibling;
                if (node is XmlElement)
                {
                    XmlElement element = (XmlElement)node;
                    if (((element.LocalName == "Claim") && (element.NamespaceURI == "http://ws-i.org/schemas/conformanceClaim/")) && ("http://ws-i.org/profiles/basic/1.1" == element.GetAttribute("conformsTo")))
                    {
                        none |= WsiProfiles.BasicProfile1_1;
                    }
                }
            }
            return(none);
        }
Ejemplo n.º 16
0
        public static bool CheckConformance(WsiProfiles claims, ServiceDescriptionCollection services, BasicProfileViolationCollection violations)
        {
            ConformanceCheckContext ctx = new ConformanceCheckContext(services, violations);

            return(Check(claims, ctx, services));
        }
 public static bool CheckConformance(WsiProfiles claims, ServiceDescriptionCollection descriptions, BasicProfileViolationCollection violations)
 {
     if ((claims & WsiProfiles.BasicProfile1_1) == WsiProfiles.None)
     {
         return true;
     }
     if (descriptions == null)
     {
         throw new ArgumentNullException("descriptions");
     }
     if (violations == null)
     {
         throw new ArgumentNullException("violations");
     }
     int count = violations.Count;
     AnalyzeDescription(descriptions, violations);
     return (count == violations.Count);
 }
		public static bool CheckConformance (WsiProfiles claims, WebReference webReference, BasicProfileViolationCollection violations)
		{
			ConformanceCheckContext ctx = new ConformanceCheckContext (webReference, violations);
			return Check (claims, ctx, webReference.Documents.Values);
		}
            public WebServiceProxyTypeBuilder(WebServiceExporter exporter, string description, string name, string ns, WsiProfiles wsiProfile)
            {
                this.exporter = exporter;

                // Creates a WebServiceAttribute from configuration info
                this.webServiceAttribute = CreateWebServiceAttribute(description, name, ns);

                // Creates a WebServiceAttribute from configuration info
                this.webServiceBindingAttribute = CreateWebServiceBindingAttribute(wsiProfile);
            }
Ejemplo n.º 20
0
 private static CustomAttributeBuilder CreateWebServiceBindingAttribute(WsiProfiles wsiProfile)
 {
     ReflectionUtils.CustomAttributeBuilderBuilder cabb =
         new ReflectionUtils.CustomAttributeBuilderBuilder(typeof(WebServiceBindingAttribute));
     if (wsiProfile == WsiProfiles.BasicProfile1_1)
     {
         cabb.AddPropertyValue("ConformsTo", wsiProfile);
     }
     return cabb.Build();
 }
Ejemplo n.º 21
0
 internal BasicProfileViolation(WsiProfiles claims, ConformanceRule rule)
 {
     _claims   = claims;
     _rule     = rule;
     _elements = new StringCollection();
 }
 public static bool CheckConformance(WsiProfiles claims, ServiceDescription description, BasicProfileViolationCollection violations)
 {
     if (description == null)
     {
         throw new ArgumentNullException("description");
     }
     ServiceDescriptionCollection descriptions = new ServiceDescriptionCollection();
     descriptions.Add(description);
     return CheckConformance(claims, descriptions, violations);
 }
 private bool IsValidWsiProfilesValue(WsiProfiles value)
 {
     return(Enum.IsDefined(typeof(WsiProfiles), value));
 }
		internal static ConformanceChecker[] GetCheckers (WsiProfiles claims)
		{
			if ((claims & WsiProfiles.BasicProfile1_1) != 0)
				return new ConformanceChecker[] { BasicProfileChecker.Instance };
			return null;
		}
 public static bool CheckConformance(WsiProfiles claims, WebReference webReference, BasicProfileViolationCollection violations)
 {
     if ((claims & WsiProfiles.BasicProfile1_1) == WsiProfiles.None)
     {
         return true;
     }
     if (webReference == null)
     {
         return true;
     }
     if (violations == null)
     {
         throw new ArgumentNullException("violations");
     }
     XmlSchemas schemas = new XmlSchemas();
     ServiceDescriptionCollection descriptions = new ServiceDescriptionCollection();
     StringCollection warnings = new StringCollection();
     foreach (DictionaryEntry entry in webReference.Documents)
     {
         ServiceDescriptionImporter.AddDocument((string) entry.Key, entry.Value, schemas, descriptions, warnings);
     }
     int count = violations.Count;
     AnalyzeDescription(descriptions, violations);
     return (count == violations.Count);
 }
Ejemplo n.º 26
0
        public static bool CheckConformance(WsiProfiles claims, WebReference webReference, BasicProfileViolationCollection violations)
        {
            ConformanceCheckContext ctx = new ConformanceCheckContext(webReference, violations);

            return(Check(claims, ctx, webReference.Documents.Values));
        }
 public WsiProfilesElement(WsiProfiles name) : this()
 {
     this.Name = name;
 }
 bool IsValidWsiProfilesValue(WsiProfiles value)
 {
     return Enum.IsDefined(typeof(WsiProfiles), value);
 }
Ejemplo n.º 29
0
		internal BasicProfileViolation (WsiProfiles claims, ConformanceRule rule)
		{
			_claims = claims;
			_rule = rule;
			_elements = new StringCollection ();
		}
Ejemplo n.º 30
0
 public WsiProfilesElement(WsiProfiles name)
 {
     this.Name = name;
 }
Ejemplo n.º 31
0
            public WebServiceProxyTypeBuilder(WebServiceExporter exporter, string description, string name, string ns, WsiProfiles wsiProfile)
            {
                this.exporter = exporter;

                // Creates a WebServiceAttribute from configuration info
                this.webServiceAttribute = CreateWebServiceAttribute(description, name, ns);

                // Creates a WebServiceAttribute from configuration info
                this.webServiceBindingAttribute = CreateWebServiceBindingAttribute(wsiProfile);
            }
        private void ReflectBinding(ReflectedBinding reflectedBinding)
        {
            string identifier = XmlConvert.EncodeLocalName(reflectedBinding.bindingAttr.Name);
            string ns         = reflectedBinding.bindingAttr.Namespace;

            if (identifier.Length == 0)
            {
                identifier = this.Service.Name + this.ProtocolName;
            }
            if (ns.Length == 0)
            {
                ns = this.ServiceDescription.TargetNamespace;
            }
            WsiProfiles none = WsiProfiles.None;

            if (reflectedBinding.bindingAttr.Location.Length > 0)
            {
                this.portType = null;
                this.binding  = null;
            }
            else
            {
                this.bindingServiceDescription = this.GetServiceDescription(ns);
                CodeIdentifiers identifiers = new CodeIdentifiers();
                foreach (System.Web.Services.Description.Binding binding in this.bindingServiceDescription.Bindings)
                {
                    identifiers.AddReserved(binding.Name);
                }
                identifier         = identifiers.AddUnique(identifier, this.binding);
                this.portType      = new System.Web.Services.Description.PortType();
                this.binding       = new System.Web.Services.Description.Binding();
                this.portType.Name = identifier;
                this.binding.Name  = identifier;
                this.binding.Type  = new XmlQualifiedName(this.portType.Name, ns);
                none = reflectedBinding.bindingAttr.ConformsTo & this.ConformsTo;
                if (reflectedBinding.bindingAttr.EmitConformanceClaims && (none != WsiProfiles.None))
                {
                    System.Web.Services.Description.ServiceDescription.AddConformanceClaims(this.binding.GetDocumentationElement(), none);
                }
                this.bindingServiceDescription.Bindings.Add(this.binding);
                this.bindingServiceDescription.PortTypes.Add(this.portType);
            }
            if (this.portNames == null)
            {
                this.portNames = new CodeIdentifiers();
                foreach (System.Web.Services.Description.Port port in this.Service.Ports)
                {
                    this.portNames.AddReserved(port.Name);
                }
            }
            this.port         = new System.Web.Services.Description.Port();
            this.port.Binding = new XmlQualifiedName(identifier, ns);
            this.port.Name    = this.portNames.AddUnique(identifier, this.port);
            this.Service.Ports.Add(this.port);
            this.BeginClass();
            if ((reflectedBinding.methodList != null) && (reflectedBinding.methodList.Count > 0))
            {
                foreach (LogicalMethodInfo info in reflectedBinding.methodList)
                {
                    this.MoveToMethod(info);
                    this.operation      = new System.Web.Services.Description.Operation();
                    this.operation.Name = XmlConvert.EncodeLocalName(info.Name);
                    if ((this.methodAttr.Description != null) && (this.methodAttr.Description.Length > 0))
                    {
                        this.operation.Documentation = this.methodAttr.Description;
                    }
                    this.operationBinding      = new System.Web.Services.Description.OperationBinding();
                    this.operationBinding.Name = this.operation.Name;
                    this.inputMessage          = null;
                    this.outputMessage         = null;
                    this.headerMessages        = null;
                    if (this.ReflectMethod())
                    {
                        if (this.inputMessage != null)
                        {
                            this.bindingServiceDescription.Messages.Add(this.inputMessage);
                        }
                        if (this.outputMessage != null)
                        {
                            this.bindingServiceDescription.Messages.Add(this.outputMessage);
                        }
                        if (this.headerMessages != null)
                        {
                            foreach (Message message in this.headerMessages)
                            {
                                this.bindingServiceDescription.Messages.Add(message);
                            }
                        }
                        this.binding.Operations.Add(this.operationBinding);
                        this.portType.Operations.Add(this.operation);
                    }
                }
            }
            if (((this.binding != null) && (none == WsiProfiles.BasicProfile1_1)) && (this.ProtocolName == "Soap"))
            {
                BasicProfileViolationCollection violations = new BasicProfileViolationCollection();
                WebServicesInteroperability.AnalyzeBinding(this.binding, this.bindingServiceDescription, this.ServiceDescriptions, violations);
                if (violations.Count > 0)
                {
                    throw new InvalidOperationException(System.Web.Services.Res.GetString("WebWsiViolation", new object[] { this.ServiceType.FullName, violations.ToString() }));
                }
            }
            this.EndClass();
        }
        internal static void AddConformanceClaims(XmlElement documentation, WsiProfiles claims) {
            //
            claims &= SupportedClaims;
            if (claims == WsiProfiles.None)
                return;

            // check already presend claims
            WsiProfiles existingClaims = GetConformanceClaims(documentation);
            claims &= ~existingClaims;
            if (claims == WsiProfiles.None)
                return;

            XmlDocument d = documentation.OwnerDocument;
            if ((claims & WsiProfiles.BasicProfile1_1) != 0) {
                XmlElement claim = d.CreateElement(Soap.ClaimPrefix, Soap.Element.Claim, Soap.ConformanceClaim);
                claim.SetAttribute(Soap.Attribute.ConformsTo, Soap.BasicProfile1_1);
                documentation.InsertBefore(claim, null);
            }
        }
Ejemplo n.º 34
0
 private void ImportReflectedMethod(SoapReflectedMethod soapMethod) {
     this.action = soapMethod.action;
     this.extensions = soapMethod.extensions;
     this.extensionInitializers = SoapReflectedExtension.GetInitializers(this.methodInfo, soapMethod.extensions);
     this.oneWay = soapMethod.oneWay;
     this.rpc = soapMethod.rpc;
     this.use = soapMethod.use;
     this.paramStyle = soapMethod.paramStyle;
     this.wsiClaims = soapMethod.binding == null ? WsiProfiles.None : soapMethod.binding.ConformsTo;
 }
        void ReflectBinding(ReflectedBinding reflectedBinding)
        {
            string bindingName      = XmlConvert.EncodeLocalName(reflectedBinding.bindingAttr.Name);
            string bindingNamespace = reflectedBinding.bindingAttr.Namespace;

            if (bindingName.Length == 0)
            {
                bindingName = Service.Name + ProtocolName;
            }
            if (bindingNamespace.Length == 0)
            {
                bindingNamespace = ServiceDescription.TargetNamespace;
            }
            WsiProfiles claims = WsiProfiles.None;

            if (reflectedBinding.bindingAttr.Location.Length > 0)
            {
                // If a URL is specified for the WSDL, file, then we just import the
                // binding from there instead of generating it in this WSDL file.
                portType = null;
                binding  = null;
            }
            else
            {
                bindingServiceDescription = GetServiceDescription(bindingNamespace);
                CodeIdentifiers bindingNames = new CodeIdentifiers();
                foreach (Binding b in bindingServiceDescription.Bindings)
                {
                    bindingNames.AddReserved(b.Name);
                }

                bindingName = bindingNames.AddUnique(bindingName, binding);

                portType      = new PortType();
                binding       = new Binding();
                portType.Name = bindingName;
                binding.Name  = bindingName;
                binding.Type  = new XmlQualifiedName(portType.Name, bindingNamespace);
                claims        = reflectedBinding.bindingAttr.ConformsTo & this.ConformsTo;
                if (reflectedBinding.bindingAttr.EmitConformanceClaims && claims != WsiProfiles.None)
                {
                    ServiceDescription.AddConformanceClaims(binding.GetDocumentationElement(), claims);
                }
                bindingServiceDescription.Bindings.Add(binding);
                bindingServiceDescription.PortTypes.Add(portType);
            }

            if (portNames == null)
            {
                portNames = new CodeIdentifiers();
                foreach (Port p in Service.Ports)
                {
                    portNames.AddReserved(p.Name);
                }
            }

            port         = new Port();
            port.Binding = new XmlQualifiedName(bindingName, bindingNamespace);
            port.Name    = portNames.AddUnique(bindingName, port);
            Service.Ports.Add(port);

            BeginClass();

            if (reflectedBinding.methodList != null && reflectedBinding.methodList.Count > 0)
            {
                foreach (LogicalMethodInfo method in reflectedBinding.methodList)
                {
                    MoveToMethod(method);

                    operation      = new Operation();
                    operation.Name = XmlConvert.EncodeLocalName(method.Name);
                    if (methodAttr.Description != null && methodAttr.Description.Length > 0)
                    {
                        operation.Documentation = methodAttr.Description;
                    }

                    operationBinding      = new OperationBinding();
                    operationBinding.Name = operation.Name;

                    inputMessage   = null;
                    outputMessage  = null;
                    headerMessages = null;

                    if (ReflectMethod())
                    {
                        if (inputMessage != null)
                        {
                            bindingServiceDescription.Messages.Add(inputMessage);
                        }
                        if (outputMessage != null)
                        {
                            bindingServiceDescription.Messages.Add(outputMessage);
                        }
                        if (headerMessages != null)
                        {
                            foreach (Message headerMessage in headerMessages)
                            {
                                bindingServiceDescription.Messages.Add(headerMessage);
                            }
                        }
                        binding.Operations.Add(operationBinding);
                        portType.Operations.Add(operation);
                    }
                }
            }
            if (binding != null && claims == WsiProfiles.BasicProfile1_1 && ProtocolName == "Soap")
            {
                BasicProfileViolationCollection warnings = new BasicProfileViolationCollection();
                WebServicesInteroperability.AnalyzeBinding(binding, bindingServiceDescription, ServiceDescriptions, warnings);
                if (warnings.Count > 0)
                {
                    throw new InvalidOperationException(Res.GetString(Res.WebWsiViolation, ServiceType.FullName, warnings.ToString()));
                }
            }
            EndClass();
        }
		public static bool CheckConformance (WsiProfiles claims, ServiceDescriptionCollection services, BasicProfileViolationCollection violations)
		{
			ConformanceCheckContext ctx = new ConformanceCheckContext (services, violations);
			return Check (claims, ctx, services);
		}