public override void Check(ConformanceCheckContext ctx, ServiceDescriptionFormatExtension value)
 {
     if (value.Required)
     {
         ctx.ReportRuleViolation(value, BasicProfileRules.R2026);
     }
 }
Esempio n. 2
0
 string GetDescription(object obj)
 {
     if (obj is ServiceDescription)
     {
         return("Service Description '" + ServiceDescription.TargetNamespace + "'");
     }
     else if (obj is Binding || obj is Message || obj is PortType || obj is Service)
     {
         return(GetNamedItemDescription(obj, ServiceDescription));
     }
     else if (obj is Import)
     {
         return(GetItemDescription(obj, ServiceDescription, ((Import)obj).Location));
     }
     else if (obj is MessageBinding)
     {
         return(GetNamedItemDescription(obj, ((MessageBinding)obj).OperationBinding));
     }
     else if (obj is MessagePart)
     {
         return(GetNamedItemDescription(obj, ((MessagePart)obj).Message));
     }
     else if (obj is Operation)
     {
         return(GetNamedItemDescription(obj, ((Operation)obj).PortType));
     }
     else if (obj is OperationBinding)
     {
         return(GetNamedItemDescription(obj, ((OperationBinding)obj).Binding));
     }
     else if (obj is OperationMessage)
     {
         return(GetNamedItemDescription(obj, ((OperationMessage)obj).Operation));
     }
     else if (obj is Port)
     {
         return(GetNamedItemDescription(obj, ((Port)obj).Service));
     }
     else if (obj is ServiceDescriptionFormatExtension)
     {
         ServiceDescriptionFormatExtension ext = (ServiceDescriptionFormatExtension)obj;
         return(GetItemDescription(ext, ext.Parent, ext.GetType().Name));
     }
     else if (obj is XmlSchema)
     {
         if (ServiceDescription == null)
         {
             return("Schema '" + ((XmlSchema)obj).TargetNamespace + "'");
         }
         else
         {
             return("Schema '" + ((XmlSchema)obj).TargetNamespace + "', in " + GetDescription(ServiceDescription));
         }
     }
     else if (obj is XmlSchemaObject)
     {
         return(obj.GetType().Name + " in Schema " + GetDescription(CurrentSchema));
     }
     return(obj.GetType().Name);
 }
Esempio n. 3
0
        protected override void SetParent(object value, object parent)
        {
            ServiceDescriptionFormatExtension extension = value as ServiceDescriptionFormatExtension;

            if (extension == null)
            {
                return;
            }
            extension.SetParent(parent);
        }
Esempio n. 4
0
 static void CheckExtensions(ConformanceCheckContext ctx, ConformanceChecker checker, ServiceDescriptionFormatExtensionCollection extensions)
 {
     foreach (object o in extensions)
     {
         ServiceDescriptionFormatExtension ext = o as ServiceDescriptionFormatExtension;
         if (ext != null)
         {
             checker.Check(ctx, ext);
         }
     }
 }
Esempio n. 5
0
        static void WriteExtension(XmlWriter writer, ServiceDescriptionFormatExtension ext)
        {
            Type          type = ext.GetType();
            ExtensionInfo info = ExtensionManager.GetFormatExtensionInfo(type);

//				if (prefix != null && prefix != "")
//					Writer.WriteStartElement (prefix, info.ElementName, info.Namespace);
//				else
//					WriteStartElement (info.ElementName, info.Namespace, false);

            XmlSerializerNamespaces ns = new XmlSerializerNamespaces();

            ns.Add("", "");
            info.Serializer.Serialize(writer, ext, ns);
        }
Esempio n. 6
0
        void AddExtensionNamespaces(XmlSerializerNamespaces ns, ServiceDescriptionFormatExtensionCollection extensions)
        {
            foreach (object o in extensions)
            {
                ServiceDescriptionFormatExtension ext = o as ServiceDescriptionFormatExtension;
                if (ext == null)
                {
                    // o can be XmlElement, skipping that
                    continue;
                }

                ExtensionInfo einf = ExtensionManager.GetFormatExtensionInfo(ext.GetType());
                foreach (XmlQualifiedName qname in einf.NamespaceDeclarations)
                {
                    ns.Add(qname.Name, qname.Namespace);
                }
            }
        }
Esempio n. 7
0
		static void WriteExtension (XmlWriter writer, ServiceDescriptionFormatExtension ext)
		{
			Type type = ext.GetType ();
			ExtensionInfo info = ExtensionManager.GetFormatExtensionInfo (type);
			
//				if (prefix != null && prefix != "")
//					Writer.WriteStartElement (prefix, info.ElementName, info.Namespace);
//				else
//					WriteStartElement (info.ElementName, info.Namespace, false);

			XmlSerializerNamespaces ns = new XmlSerializerNamespaces ();
			ns.Add ("","");
			info.Serializer.Serialize (writer, ext, ns);
		}
        private void CreateHeaderMessages(string methodName, SoapBindingUse use, XmlMembersMapping inHeaderMappings, XmlMembersMapping outHeaderMappings, SoapReflectedHeader[] headers, bool rpc)
        {
            if (use == SoapBindingUse.Encoded)
            {
                this.SoapExporter.ExportMembersMapping(inHeaderMappings, false);
                if (outHeaderMappings != null)
                {
                    this.SoapExporter.ExportMembersMapping(outHeaderMappings, false);
                }
            }
            else
            {
                base.SchemaExporter.ExportMembersMapping(inHeaderMappings);
                if (outHeaderMappings != null)
                {
                    base.SchemaExporter.ExportMembersMapping(outHeaderMappings);
                }
            }
            CodeIdentifiers identifiers = new CodeIdentifiers();
            int             num         = 0;
            int             num2        = 0;

            for (int i = 0; i < headers.Length; i++)
            {
                SoapReflectedHeader header = headers[i];
                if (header.custom)
                {
                    XmlMemberMapping mapping;
                    Message          message;
                    if ((header.direction & SoapHeaderDirection.In) != 0)
                    {
                        mapping = inHeaderMappings[num++];
                        if (header.direction != SoapHeaderDirection.In)
                        {
                            num2++;
                        }
                    }
                    else
                    {
                        mapping = outHeaderMappings[num2++];
                    }
                    MessagePart messagePart = new MessagePart {
                        Name = mapping.XsdElementName
                    };
                    if (use == SoapBindingUse.Encoded)
                    {
                        messagePart.Type = new XmlQualifiedName(mapping.TypeName, mapping.TypeNamespace);
                    }
                    else
                    {
                        messagePart.Element = new XmlQualifiedName(mapping.XsdElementName, mapping.Namespace);
                    }
                    message = new Message {
                        Name = identifiers.AddUnique(methodName + messagePart.Name, message)
                    };
                    message.Parts.Add(messagePart);
                    base.HeaderMessages.Add(message);
                    ServiceDescriptionFormatExtension extension = this.CreateSoapHeaderBinding(new XmlQualifiedName(message.Name, base.Binding.ServiceDescription.TargetNamespace), messagePart.Name, rpc ? mapping.Namespace : null, use);
                    if ((header.direction & SoapHeaderDirection.In) != 0)
                    {
                        base.OperationBinding.Input.Extensions.Add(extension);
                    }
                    if ((header.direction & SoapHeaderDirection.Out) != 0)
                    {
                        base.OperationBinding.Output.Extensions.Add(extension);
                    }
                    if ((header.direction & SoapHeaderDirection.Fault) != 0)
                    {
                        if (this.soapMethod.IsClaimsConformance)
                        {
                            throw new InvalidOperationException(System.Web.Services.Res.GetString("BPConformanceHeaderFault", new object[] { this.soapMethod.methodInfo.ToString(), this.soapMethod.methodInfo.DeclaringType.FullName, "Direction", typeof(SoapHeaderDirection).Name, SoapHeaderDirection.Fault.ToString() }));
                        }
                        base.OperationBinding.Output.Extensions.Add(extension);
                    }
                }
            }
        }
Esempio n. 9
0
 public virtual void Check(ConformanceCheckContext ctx, ServiceDescriptionFormatExtension value)
 {
 }
Esempio n. 10
0
        void CreateHeaderMessages(string methodName, SoapBindingUse use, XmlMembersMapping inHeaderMappings, XmlMembersMapping outHeaderMappings, SoapReflectedHeader[] headers)
        {
            // CONSIDER, alexdej: support headerfault.
            if (use == SoapBindingUse.Encoded)
            {
                SoapExporter.ExportMembersMapping(inHeaderMappings, false);
                if (outHeaderMappings != null)
                {
                    SoapExporter.ExportMembersMapping(outHeaderMappings, false);
                }
            }
            else
            {
                SchemaExporter.ExportMembersMapping(inHeaderMappings);
                if (outHeaderMappings != null)
                {
                    SchemaExporter.ExportMembersMapping(outHeaderMappings);
                }
            }

            CodeIdentifiers identifiers = new CodeIdentifiers();
            int             inCount = 0, outCount = 0;

            for (int i = 0; i < headers.Length; i++)
            {
                SoapReflectedHeader soapHeader = headers[i];
                if (!soapHeader.custom)
                {
                    continue;
                }

                XmlMemberMapping member;
                if ((soapHeader.direction & SoapHeaderDirection.In) != 0)
                {
                    member = inHeaderMappings[inCount++];
                    if (soapHeader.direction != SoapHeaderDirection.In)
                    {
                        outCount++;
                    }
                }
                else
                {
                    member = outHeaderMappings[outCount++];
                }

                MessagePart part = new MessagePart();
                part.Name = member.ElementName;
                if (use == SoapBindingUse.Encoded)
                {
                    part.Type = new XmlQualifiedName(member.TypeName, member.TypeNamespace);
                }
                else
                {
                    part.Element = new XmlQualifiedName(member.ElementName, member.Namespace);
                }

                Message message = new Message();
                message.Name = identifiers.AddUnique(methodName + part.Name, message);
                message.Parts.Add(part);
                HeaderMessages.Add(message);

                ServiceDescriptionFormatExtension soapHeaderBinding = CreateSoapHeaderBinding(new XmlQualifiedName(message.Name, Binding.ServiceDescription.TargetNamespace), part.Name, use);

                if ((soapHeader.direction & SoapHeaderDirection.In) != 0)
                {
                    OperationBinding.Input.Extensions.Add(soapHeaderBinding);
                }
                if ((soapHeader.direction & (SoapHeaderDirection.Out | SoapHeaderDirection.Fault)) != 0)
                {
                    OperationBinding.Output.Extensions.Add(soapHeaderBinding);
                }
            }
        }
		public override void Check (ConformanceCheckContext ctx, ServiceDescriptionFormatExtension value)
		{
			if (value.Required)
				ctx.ReportRuleViolation (value, BasicProfileRules.R2026);
		}
Esempio n. 12
0
		public virtual void Check (ConformanceCheckContext ctx, ServiceDescriptionFormatExtension value) {}
Esempio n. 13
0
        void CreateHeaderMessages(string methodName, SoapBindingUse use, XmlMembersMapping inHeaderMappings, XmlMembersMapping outHeaderMappings, SoapReflectedHeader[] headers, bool rpc)
        {
            //
            if (use == SoapBindingUse.Encoded)
            {
                SoapExporter.ExportMembersMapping(inHeaderMappings, false);
                if (outHeaderMappings != null)
                {
                    SoapExporter.ExportMembersMapping(outHeaderMappings, false);
                }
            }
            else
            {
                SchemaExporter.ExportMembersMapping(inHeaderMappings);
                if (outHeaderMappings != null)
                {
                    SchemaExporter.ExportMembersMapping(outHeaderMappings);
                }
            }

            CodeIdentifiers identifiers = new CodeIdentifiers();
            int             inCount = 0, outCount = 0;

            for (int i = 0; i < headers.Length; i++)
            {
                SoapReflectedHeader soapHeader = headers[i];
                if (!soapHeader.custom)
                {
                    continue;
                }

                XmlMemberMapping member;
                if ((soapHeader.direction & SoapHeaderDirection.In) != 0)
                {
                    member = inHeaderMappings[inCount++];
                    if (soapHeader.direction != SoapHeaderDirection.In)
                    {
                        outCount++;
                    }
                }
                else
                {
                    member = outHeaderMappings[outCount++];
                }

                MessagePart part = new MessagePart();
                part.Name = member.XsdElementName;
                if (use == SoapBindingUse.Encoded)
                {
                    part.Type = new XmlQualifiedName(member.TypeName, member.TypeNamespace);
                }
                else
                {
                    part.Element = new XmlQualifiedName(member.XsdElementName, member.Namespace);
                }
                Message message = new Message();
                message.Name = identifiers.AddUnique(methodName + part.Name, message);
                message.Parts.Add(part);
                HeaderMessages.Add(message);

                ServiceDescriptionFormatExtension soapHeaderBinding = CreateSoapHeaderBinding(new XmlQualifiedName(message.Name, Binding.ServiceDescription.TargetNamespace), part.Name, rpc ? member.Namespace : null, use);

                if ((soapHeader.direction & SoapHeaderDirection.In) != 0)
                {
                    OperationBinding.Input.Extensions.Add(soapHeaderBinding);
                }
                if ((soapHeader.direction & SoapHeaderDirection.Out) != 0)
                {
                    OperationBinding.Output.Extensions.Add(soapHeaderBinding);
                }

                if ((soapHeader.direction & SoapHeaderDirection.Fault) != 0)
                {
                    if (soapMethod.IsClaimsConformance)
                    {
                        throw new InvalidOperationException(Res.GetString(Res.BPConformanceHeaderFault, soapMethod.methodInfo.ToString(), soapMethod.methodInfo.DeclaringType.FullName, "Direction", typeof(SoapHeaderDirection).Name, SoapHeaderDirection.Fault.ToString()));
                    }
                    OperationBinding.Output.Extensions.Add(soapHeaderBinding);
                }
            }
        }