private PartInfo CreatePartInfo(MessagePartDescription part, OperationFormatStyle style, DataContractSerializerOperationBehavior serializerFactory)
        {
            string   ns       = (style == OperationFormatStyle.Rpc || part.Namespace == null) ? string.Empty : part.Namespace;
            PartInfo partInfo = new PartInfo(part, AddToDictionary(part.Name), AddToDictionary(ns), _knownTypes, serializerFactory);

            return(partInfo);
        }
 static internal void ValidateOperationFormatStyle(OperationFormatStyle value)
 {
     if (!OperationFormatStyleHelper.IsDefined(value))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value"));
     }
 }
        void IOperationContractGenerationExtension.GenerateOperation(OperationContractGenerationContext context)
        {
            DataContractSerializerOperationBehavior behavior  = context.Operation.Behaviors.Find <DataContractSerializerOperationBehavior>();
            DataContractFormatAttribute             attribute = (behavior == null) ? new DataContractFormatAttribute() : behavior.DataContractFormatAttribute;
            OperationFormatStyle style = attribute.Style;

            this.operationGenerator.GenerateOperation(context, ref style, false, new WrappedBodyTypeGenerator(this, context), this.knownTypes);
            attribute.Style = style;
            if (attribute.Style != TypeLoader.DefaultDataContractFormatAttribute.Style)
            {
                context.SyncMethod.CustomAttributes.Add(System.ServiceModel.Description.OperationGenerator.GenerateAttributeDeclaration(context.Contract.ServiceContractGenerator, attribute));
            }
            if (this.knownTypes != null)
            {
                Dictionary <CodeTypeReference, object> operationKnownTypes = new Dictionary <CodeTypeReference, object>(new CodeTypeReferenceComparer());
                foreach (MessageDescription description in context.Operation.Messages)
                {
                    foreach (MessagePartDescription description2 in description.Body.Parts)
                    {
                        this.AddKnownTypesForPart(context, description2, operationKnownTypes);
                    }
                    foreach (MessageHeaderDescription description3 in description.Headers)
                    {
                        this.AddKnownTypesForPart(context, description3, operationKnownTypes);
                    }
                    if (OperationFormatter.IsValidReturnValue(description.Body.ReturnValue))
                    {
                        this.AddKnownTypesForPart(context, description.Body.ReturnValue, operationKnownTypes);
                    }
                }
            }
            UpdateTargetCompileUnit(context, this.codeCompileUnit);
        }
 static public bool IsDefined(OperationFormatStyle x)
 {
     return
         (x == OperationFormatStyle.Document ||
          x == OperationFormatStyle.Rpc ||
          false);
 }
Exemple #5
0
        private PartInfo CreatePartInfo(MessagePartDescription part, OperationFormatStyle style, DataContractSerializerOperationBehavior serializerFactory)
        {
            this.ValidateDataContractType(part.Type);
            string s = ((style == OperationFormatStyle.Rpc) || (part.Namespace == null)) ? string.Empty : part.Namespace;

            return(new PartInfo(part, base.AddToDictionary(part.Name), base.AddToDictionary(s), this.knownTypes, serializerFactory));
        }
        // Assumption: gets called exactly once per operation
        void IOperationContractGenerationExtension.GenerateOperation(OperationContractGenerationContext context)
        {
            DataContractSerializerOperationBehavior DataContractSerializerOperationBehavior = context.Operation.Behaviors.Find <DataContractSerializerOperationBehavior>() as DataContractSerializerOperationBehavior;
            DataContractFormatAttribute             dataContractFormatAttribute             = (DataContractSerializerOperationBehavior == null) ? new DataContractFormatAttribute() : DataContractSerializerOperationBehavior.DataContractFormatAttribute;
            OperationFormatStyle style = dataContractFormatAttribute.Style;

            operationGenerator.GenerateOperation(context, ref style, false /*isEncoded*/, new WrappedBodyTypeGenerator(this, context), knownTypes);
            dataContractFormatAttribute.Style = style;
            if (dataContractFormatAttribute.Style != TypeLoader.DefaultDataContractFormatAttribute.Style)
            {
                context.SyncMethod.CustomAttributes.Add(OperationGenerator.GenerateAttributeDeclaration(context.Contract.ServiceContractGenerator, dataContractFormatAttribute));
            }
            if (knownTypes != null)
            {
                Dictionary <CodeTypeReference, object> operationKnownTypes = new Dictionary <CodeTypeReference, object>(new CodeTypeReferenceComparer());
                foreach (MessageDescription message in context.Operation.Messages)
                {
                    foreach (MessagePartDescription part in message.Body.Parts)
                    {
                        AddKnownTypesForPart(context, part, operationKnownTypes);
                    }
                    foreach (MessageHeaderDescription header in message.Headers)
                    {
                        AddKnownTypesForPart(context, header, operationKnownTypes);
                    }
                    if (OperationFormatter.IsValidReturnValue(message.Body.ReturnValue))
                    {
                        AddKnownTypesForPart(context, message.Body.ReturnValue, operationKnownTypes);
                    }
                }
            }
            UpdateTargetCompileUnit(context, this.codeCompileUnit);
        }
 static public bool IsDefined(OperationFormatStyle x)
 {
     return
         x == OperationFormatStyle.Document ||
         x == OperationFormatStyle.Rpc ||
         false;
 }
 static internal void ValidateOperationFormatStyle(OperationFormatStyle value)
 {
     if (!OperationFormatStyleHelper.IsDefined(value))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value"));
     }
 }
Exemple #9
0
 public static bool IsDefined(OperationFormatStyle x)
 {
     if (x != OperationFormatStyle.Document)
     {
         return(x == OperationFormatStyle.Rpc);
     }
     return(true);
 }
 public static bool IsDefined(OperationFormatStyle x)
 {
     if (x != OperationFormatStyle.Document)
     {
         return (x == OperationFormatStyle.Rpc);
     }
     return true;
 }
Exemple #11
0
		public static bool IsDefined (OperationFormatStyle style)
		{
			switch (style) {
			case OperationFormatStyle.Document:
			case OperationFormatStyle.Rpc:
				return true;
			}
			return false;
		}
Exemple #12
0
        // Assumption: gets called exactly once per operation
        void IOperationContractGenerationExtension.GenerateOperation(OperationContractGenerationContext context)
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }
            if (partInfoTable != null && partInfoTable.Count > 0)
            {
                Dictionary <XmlMembersMapping, XmlMembersMapping> alreadyExported = new Dictionary <XmlMembersMapping, XmlMembersMapping>();
                foreach (MessageDescription message in context.Operation.Messages)
                {
                    foreach (MessageHeaderDescription header in message.Headers)
                    {
                        GeneratePartType(alreadyExported, header, header.Namespace);
                    }


                    MessageBodyDescription body = message.Body;
                    bool isWrapped = (body.WrapperName != null);
                    if (OperationFormatter.IsValidReturnValue(body.ReturnValue))
                    {
                        GeneratePartType(alreadyExported, body.ReturnValue, isWrapped ? body.WrapperNamespace : body.ReturnValue.Namespace);
                    }

                    foreach (MessagePartDescription part in body.Parts)
                    {
                        GeneratePartType(alreadyExported, part, isWrapped ? body.WrapperNamespace : part.Namespace);
                    }
                }
            }
            XmlSerializerOperationBehavior xmlSerializerOperationBehavior = context.Operation.Behaviors.Find <XmlSerializerOperationBehavior>() as XmlSerializerOperationBehavior;

            if (xmlSerializerOperationBehavior == null)
            {
                return;
            }

            XmlSerializerFormatAttribute xmlSerializerFormatAttribute = (xmlSerializerOperationBehavior == null) ? new XmlSerializerFormatAttribute() : xmlSerializerOperationBehavior.XmlSerializerFormatAttribute;
            OperationFormatStyle         style = xmlSerializerFormatAttribute.Style;

            operationGenerator.GenerateOperation(context, ref style, xmlSerializerFormatAttribute.IsEncoded, new WrappedBodyTypeGenerator(context), new Dictionary <MessagePartDescription, ICollection <CodeTypeReference> >());
            context.ServiceContractGenerator.AddReferencedAssembly(typeof(System.Xml.Serialization.XmlTypeAttribute).Assembly);
            xmlSerializerFormatAttribute.Style = style;
            context.SyncMethod.CustomAttributes.Add(OperationGenerator.GenerateAttributeDeclaration(context.Contract.ServiceContractGenerator, xmlSerializerFormatAttribute));
            AddKnownTypes(context.SyncMethod.CustomAttributes, xmlSerializerFormatAttribute.IsEncoded ? SoapExporter.IncludeMetadata : XmlExporter.IncludeMetadata);
            DataContractSerializerOperationGenerator.UpdateTargetCompileUnit(context, this.options.CodeCompileUnit);
        }
Exemple #13
0
        void IOperationContractGenerationExtension.GenerateOperation(OperationContractGenerationContext context)
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }
            if ((this.partInfoTable != null) && (this.partInfoTable.Count > 0))
            {
                Dictionary <XmlMembersMapping, XmlMembersMapping> alreadyExported = new Dictionary <XmlMembersMapping, XmlMembersMapping>();
                foreach (MessageDescription description in context.Operation.Messages)
                {
                    foreach (MessageHeaderDescription description2 in description.Headers)
                    {
                        this.GeneratePartType(alreadyExported, description2);
                    }
                    if (OperationFormatter.IsValidReturnValue(description.Body.ReturnValue))
                    {
                        this.GeneratePartType(alreadyExported, description.Body.ReturnValue);
                    }
                    foreach (MessagePartDescription description3 in description.Body.Parts)
                    {
                        this.GeneratePartType(alreadyExported, description3);
                    }
                }
            }
            XmlSerializerOperationBehavior behavior = context.Operation.Behaviors.Find <XmlSerializerOperationBehavior>();

            if (behavior != null)
            {
                XmlSerializerFormatAttribute attribute = (behavior == null) ? new XmlSerializerFormatAttribute() : behavior.XmlSerializerFormatAttribute;
                OperationFormatStyle         style     = attribute.Style;
                this.operationGenerator.GenerateOperation(context, ref style, attribute.IsEncoded, new WrappedBodyTypeGenerator(context), new Dictionary <MessagePartDescription, ICollection <CodeTypeReference> >());
                context.ServiceContractGenerator.AddReferencedAssembly(typeof(XmlTypeAttribute).Assembly);
                attribute.Style = style;
                context.SyncMethod.CustomAttributes.Add(System.ServiceModel.Description.OperationGenerator.GenerateAttributeDeclaration(context.Contract.ServiceContractGenerator, attribute));
                this.AddKnownTypes(context.SyncMethod.CustomAttributes, attribute.IsEncoded ? this.SoapExporter.IncludeMetadata : this.XmlExporter.IncludeMetadata);
                DataContractSerializerOperationGenerator.UpdateTargetCompileUnit(context, this.options.CodeCompileUnit);
            }
        }
 internal override bool CanImportStyleAndUse(OperationFormatStyle style, bool isEncoded)
 {
     // Intentionally return true in all cases. Warning will be generated later if there are multiple bindings and one is doc-encoded.
     return true;
 }
 internal override void ValidateStyleAndUse(OperationFormatStyle style, bool isEncoded, string operationName)
 {
     if (isEncoded && style != OperationFormatStyle.Rpc)
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxDocEncodedNotSupported, operationName)));
 }
 internal override void ValidateStyleAndUse(OperationFormatStyle style, bool isEncoded, string operationName)
 {
     if (isEncoded)
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.SFxDataContractSerializerDoesNotSupportEncoded, operationName)));
 }
 internal override void SetOperationStyle(OperationDescription operation, OperationFormatStyle style)
 {
     DataContractSerializerOperationBehavior operationBehavior = operation.Behaviors.Find<DataContractSerializerOperationBehavior>();
     if (operationBehavior == null)
     {
         operationBehavior = new DataContractSerializerOperationBehavior(operation, new DataContractFormatAttribute());
         operation.Behaviors.Add(operationBehavior);
     }
     operationBehavior.DataContractFormatAttribute.Style = style;
 }
 private PartInfo CreatePartInfo(MessagePartDescription part, OperationFormatStyle style, DataContractSerializerOperationBehavior serializerFactory)
 {
     this.ValidateDataContractType(part.Type);
     string s = ((style == OperationFormatStyle.Rpc) || (part.Namespace == null)) ? string.Empty : part.Namespace;
     return new PartInfo(part, base.AddToDictionary(part.Name), base.AddToDictionary(s), this.knownTypes, serializerFactory);
 }
 internal override bool CanImportStyleAndUse(OperationFormatStyle style, bool isEncoded)
 {
     return !isEncoded;
 }
 bool CanImportStream(WsdlNS.MessagePart part, out OperationFormatStyle? style, ref bool areAllMessagesWrapped)
 {
     style = OperationFormatStyle.Document;
     string ns;
     XmlSchemaForm elementFormDefault;
     if (areAllMessagesWrapped && IsWrapperPart(part))
     {
         XmlSchemaComplexType complexType = GetElementComplexType(part.Element, allSchemas, out ns, out elementFormDefault);
         if (complexType != null)
         {
             XmlSchemaSequence rootSequence = GetRootSequence(complexType);
             if (rootSequence != null && rootSequence.Items.Count == 1 && rootSequence.Items[0] is XmlSchemaElement)
                 return CheckPart(((XmlSchemaElement)rootSequence.Items[0]).SchemaTypeName, DataContractSerializerMessageContractImporter.StreamBodyTypeName);
         }
         return false;
     }
     areAllMessagesWrapped = false;
     XmlQualifiedName typeName = part.Type;
     style = OperationFormatStyle.Rpc;
     if (IsNullOrEmpty(typeName))
     {
         if (IsNullOrEmpty(part.Element))
             return false;
         style = OperationFormatStyle.Document;
         typeName = GetTypeName(FindSchemaElement(allSchemas, part.Element));
     }
     return CheckPart(typeName, DataContractSerializerMessageContractImporter.StreamBodyTypeName);
 }
        bool CanImportMessageBinding(WsdlNS.MessageBinding messageBinding, WsdlNS.Message wsdlMessage, OperationFormatStyle style, out bool isEncoded)
        {
            isEncoded = false;

            bool? isMessageEncoded = null;
            foreach (object extension in messageBinding.Extensions)
            {
                bool currentIsEncoded;
                WsdlNS.SoapHeaderBinding soapHeaderBinding = extension as WsdlNS.SoapHeaderBinding;

                if (soapHeaderBinding != null)
                {
                    if (!ValidWsdl.Check(soapHeaderBinding, messageBinding, AddWarning))
                        return false;

                    if (!CanImportMessageHeaderBinding(soapHeaderBinding, wsdlMessage, style, out currentIsEncoded))
                        return false;
                    if (isMessageEncoded == null)
                        isMessageEncoded = currentIsEncoded;
                    else if (isMessageEncoded.Value != currentIsEncoded)
                        AddError(SR.GetString(SR.SFxInconsistentWsdlOperationUseInBindingExtensions, messageBinding.OperationBinding.Name, messageBinding.OperationBinding.Binding.Name));
                }
                else
                {
                    WsdlNS.SoapBodyBinding soapBodyBinding = extension as WsdlNS.SoapBodyBinding;
                    if (soapBodyBinding != null)
                    {
                        if (!CanImportMessageBodyBinding(soapBodyBinding, style, out currentIsEncoded))
                            return false;
                        if (isMessageEncoded == null)
                            isMessageEncoded = currentIsEncoded;
                        else if (isMessageEncoded.Value != currentIsEncoded)
                            AddError(SR.GetString(SR.SFxInconsistentWsdlOperationUseInBindingExtensions, messageBinding.OperationBinding.Name, messageBinding.OperationBinding.Binding.Name));
                        string[] messageParts = soapBodyBinding.Parts;
                        if (messageParts == null)
                        {
                            messageParts = new string[wsdlMessage.Parts.Count];
                            for (int i = 0; i < messageParts.Length; i++)
                                messageParts[i] = wsdlMessage.Parts[i].Name;
                        }
                        IList<string> bodyPartsFromBindings;
                        bool isFirstBinding = false;
                        if (!BodyPartsTable.TryGetValue(wsdlMessage, out bodyPartsFromBindings))
                        {
                            bodyPartsFromBindings = new List<string>();
                            BodyPartsTable.Add(wsdlMessage, bodyPartsFromBindings);
                            isFirstBinding = true;
                        }
                        foreach (string partName in messageParts)
                        {
                            if (string.IsNullOrEmpty(partName))
                                continue;
                            if (isFirstBinding)
                                bodyPartsFromBindings.Add(partName);
                            else if (!bodyPartsFromBindings.Contains(partName))
                            {
                                AddError(SR.GetString(SR.SFxInconsistentBindingBodyParts, messageBinding.OperationBinding.Name, messageBinding.OperationBinding.Binding.Name, partName));
                                bodyPartsFromBindings.Add(partName);
                            }
                        }
                    }
                }
            }
            if (isMessageEncoded != null)
                isEncoded = isMessageEncoded.Value;
            return true;
        }
 internal override void SetOperationStyle(OperationDescription operation, OperationFormatStyle style)
 {
     XmlSerializerFormatAttribute operationAttribute = GetFormatAttribute(operation, true/*createNew*/);
     operationAttribute.Style = style;
 }
        bool CanImportMessage(WsdlNS.Message wsdlMessage, string operationName, out OperationFormatStyle? inferredStyle, ref bool areAllMessagesWrapped)
        {
            WsdlNS.MessagePartCollection messageParts = wsdlMessage.Parts;
            // try the special cases: wrapped and Message
            if (messageParts.Count == 1)
            {
                if (CanImportAnyMessage(messageParts[0]))
                {
                    areAllMessagesWrapped = false;
                    inferredStyle = OperationFormatStyle.Document;
                    return true;
                }

                if (CanImportStream(messageParts[0], out inferredStyle, ref areAllMessagesWrapped))
                    return true;

                if (areAllMessagesWrapped && CanImportWrappedMessage(messageParts[0]))
                {
                    inferredStyle = OperationFormatStyle.Document;
                    return true;
                }
                areAllMessagesWrapped = false;
            }

            inferredStyle = null;
            IList<string> bodyPartsFromBindings;
            BodyPartsTable.TryGetValue(wsdlMessage, out bodyPartsFromBindings);
            foreach (WsdlNS.MessagePart part in messageParts)
            {
                if (bodyPartsFromBindings != null && !bodyPartsFromBindings.Contains(part.Name))
                    continue;
                OperationFormatStyle style;
                if (!CurrentSchemaImporter.CanImportMessagePart(part, out style))
                    return false;

                if (inferredStyle == null)
                    inferredStyle = style;
                else if (style != inferredStyle.Value)
                    AddError(SR.GetString(SR.SFxInconsistentWsdlOperationStyleInMessageParts, operationName));
            }
            return true;
        }
 void ImportMessageBodyBinding(WsdlNS.SoapBodyBinding bodyBinding, WsdlNS.Message wsdlMessage, MessageDescription description, OperationFormatStyle style, bool isEncoded, string operationName)
 {
     if (style == OperationFormatStyle.Rpc && bodyBinding.Namespace != null)
         description.Body.WrapperNamespace = bodyBinding.Namespace;
     this.CurrentSchemaImporter.ValidateStyleAndUse(style, isEncoded, operationName);
 }
 void ImportMessageBinding(WsdlNS.MessageBinding messageBinding, WsdlNS.Message wsdlMessage, MessageDescription description, OperationFormatStyle style, bool isEncoded)
 {
     WsdlNS.OperationMessage wsdlOperationMessage = contractContext.GetOperationMessage(description);
     foreach (object extension in messageBinding.Extensions)
     {
         WsdlNS.SoapHeaderBinding soapHeaderBinding = extension as WsdlNS.SoapHeaderBinding;
         if (soapHeaderBinding != null)
         {
             ImportMessageHeaderBinding(soapHeaderBinding, wsdlMessage, description, style, isEncoded, messageBinding.OperationBinding.Name);
         }
         else
         {
             WsdlNS.SoapBodyBinding soapBodyBinding = extension as WsdlNS.SoapBodyBinding;
             if (soapBodyBinding != null)
             {
                 ImportMessageBodyBinding(soapBodyBinding, wsdlMessage, description, style, isEncoded, messageBinding.OperationBinding.Name);
             }
         }
     }
 }
        bool CanImportMessageHeaderBinding(WsdlNS.SoapHeaderBinding headerBinding, WsdlNS.Message wsdlMessage, OperationFormatStyle style, out bool isEncoded)
        {
            isEncoded = (headerBinding.Use == WsdlNS.SoapBindingUse.Encoded);
            WsdlNS.Message wsdlHeaderMessage = wsdlMessage.ServiceDescription.ServiceDescriptions.GetMessage(headerBinding.Message);
            WsdlNS.MessagePart part = FindPartByName(wsdlHeaderMessage, headerBinding.Part);

            OperationFormatStyle headerStyle;
            if (!CurrentSchemaImporter.CanImportMessagePart(part, out headerStyle))
                return false;
            if (headerStyle != style)
                AddError(SR.GetString(SR.SFxInconsistentWsdlOperationStyleInHeader, part.Name, headerStyle, style));
            return CurrentSchemaImporter.CanImportStyleAndUse(style, isEncoded);
        }
 bool CanImportMessageBodyBinding(WsdlNS.SoapBodyBinding bodyBinding, OperationFormatStyle style, out bool isEncoded)
 {
     isEncoded = (bodyBinding.Use == WsdlNS.SoapBindingUse.Encoded);
     return CurrentSchemaImporter.CanImportStyleAndUse(style, isEncoded);
 }
        private bool CanImportFaultBinding(WsdlNS.FaultBinding faultBinding, OperationFormatStyle style, out bool isFaultEncoded)
        {
            bool? isEncoded = null;
            bool currentIsEncoded;
            foreach (object extension in faultBinding.Extensions)
            {
                XmlElement soapFaultBindingRaw = extension as XmlElement;
                if (SoapHelper.IsSoapFaultBinding(soapFaultBindingRaw))
                {
                    currentIsEncoded = SoapHelper.IsEncoded(soapFaultBindingRaw);
                }
                else
                {
                    WsdlNS.SoapFaultBinding soapFaultBinding = extension as WsdlNS.SoapFaultBinding;
                    if (soapFaultBinding == null)
                        continue;

                    if (!ValidWsdl.Check(soapFaultBinding, faultBinding, AddWarning))
                        continue;
                    currentIsEncoded = (soapFaultBinding.Use == System.Web.Services.Description.SoapBindingUse.Encoded);
                }

                if (isEncoded == null)
                    isEncoded = currentIsEncoded;
                else if (isEncoded.Value != currentIsEncoded)
                    AddError(SR.GetString(SR.SFxInconsistentWsdlOperationUseInBindingExtensions, faultBinding.OperationBinding.Name, faultBinding.OperationBinding.Binding.Name));
            }
            isFaultEncoded = isEncoded ?? false;
            return this.CurrentSchemaImporter.CanImportStyleAndUse(style, isFaultEncoded);
        }
 internal OperationInfo(OperationFormatStyle style, bool isEncoded, bool areAllMessagesWrapped)
 {
     this.style = style;
     this.isEncoded = isEncoded;
     this.areAllMessagesWrapped = areAllMessagesWrapped;
 }
 internal bool CanImportMessagePart(WsdlNS.MessagePart part, out OperationFormatStyle style)
 {
     style = OperationFormatStyle.Document;
     if (!IsNullOrEmpty(part.Element))
         return CanImportElement(FindSchemaElement(this.schemaSet, part.Element));
     if (!IsNullOrEmpty(part.Type))
     {
         style = OperationFormatStyle.Rpc;
         return CanImportType(part.Type);
     }
     return false;
 }
 static StyleAndUse GetStyleAndUse(OperationFormatStyle style, bool isEncoded)
 {
     if (style == OperationFormatStyle.Document)
     {
         return isEncoded ? StyleAndUse.DocumentEncoded : StyleAndUse.DocumentLiteral;
     }
     else
     {
         return isEncoded ? StyleAndUse.RpcEncoded : StyleAndUse.RpcLiteral;
     }
 }
 internal abstract bool CanImportStyleAndUse(OperationFormatStyle style, bool isEncoded);
 internal abstract void ValidateStyleAndUse(OperationFormatStyle style, bool isEncoded, string operationName);
 internal abstract void SetOperationStyle(OperationDescription operation, OperationFormatStyle style);
 void ImportMessageHeaderBinding(WsdlNS.SoapHeaderBinding headerBinding, WsdlNS.Message wsdlMessage, MessageDescription description, OperationFormatStyle style, bool isEncoded, string operationName)
 {
     WsdlNS.Message wsdlHeaderMessage = wsdlMessage.ServiceDescription.ServiceDescriptions.GetMessage(headerBinding.Message);
     WsdlNS.MessagePart part = FindPartByName(wsdlHeaderMessage, headerBinding.Part);
     if (!description.Headers.Contains(this.CurrentSchemaImporter.GetPartName(part)))
     {
         description.Headers.Add((MessageHeaderDescription)schemaImporter.ImportMessagePart(part, true/*isHeader*/, isEncoded));
         this.CurrentSchemaImporter.ValidateStyleAndUse(style, isEncoded, operationName);
     }
 }
 private PartInfo CreatePartInfo(MessagePartDescription part, OperationFormatStyle style, DataContractSerializerOperationBehavior serializerFactory)
 {
     string ns = (style == OperationFormatStyle.Rpc || part.Namespace == null) ? string.Empty : part.Namespace;
     PartInfo partInfo = new PartInfo(part, AddToDictionary(part.Name), AddToDictionary(ns), _knownTypes, serializerFactory);
     return partInfo;
 }