static WsdlNS.SoapBodyBinding ConvertSoapBodyBinding(WsdlNS.SoapBodyBinding src, EnvelopeVersion version)
            {
                if (version == EnvelopeVersion.None)
                {
                    return(null);
                }

                EnvelopeVersion srcVersion = GetBindingVersion <WsdlNS.Soap12BodyBinding>(src);

                if (srcVersion == version)
                {
                    return(src);
                }

                WsdlNS.SoapBodyBinding dest = version == EnvelopeVersion.Soap12 ? new WsdlNS.Soap12BodyBinding() : new WsdlNS.SoapBodyBinding();
                if (src != null)
                {
                    if (XmlSerializerOperationFormatter.GetEncoding(srcVersion) == src.Encoding)
                    {
                        dest.Encoding = XmlSerializerOperationFormatter.GetEncoding(version);
                    }
                    dest.Encoding    = XmlSerializerOperationFormatter.GetEncoding(version);
                    dest.Namespace   = src.Namespace;
                    dest.Parts       = src.Parts;
                    dest.PartsString = src.PartsString;
                    dest.Use         = src.Use;
                    dest.Required    = src.Required;
                }
                return(dest);
            }
示例#2
0
            private static SoapBodyBinding ConvertSoapBodyBinding(SoapBodyBinding src, EnvelopeVersion version)
            {
                if (version == EnvelopeVersion.None)
                {
                    return(null);
                }
                EnvelopeVersion bindingVersion = GetBindingVersion <Soap12BodyBinding>(src);

                if (bindingVersion == version)
                {
                    return(src);
                }
                SoapBodyBinding binding = (version == EnvelopeVersion.Soap12) ? new Soap12BodyBinding() : new SoapBodyBinding();

                if (src != null)
                {
                    if (XmlSerializerOperationFormatter.GetEncoding(bindingVersion) == src.Encoding)
                    {
                        binding.Encoding = XmlSerializerOperationFormatter.GetEncoding(version);
                    }
                    binding.Encoding    = XmlSerializerOperationFormatter.GetEncoding(version);
                    binding.Namespace   = src.Namespace;
                    binding.Parts       = src.Parts;
                    binding.PartsString = src.PartsString;
                    binding.Use         = src.Use;
                    binding.Required    = src.Required;
                }
                return(binding);
            }
示例#3
0
            private void ExportMessageHeaderBinding(MessageHeaderDescription header, XmlQualifiedName messageName, bool isEncoded, MessageBinding messageBinding)
            {
                SoapHeaderBinding binding = SoapHelper.CreateSoapHeaderBinding(this.endpointContext, messageBinding);

                binding.Part    = string.IsNullOrEmpty(header.UniquePartName) ? header.Name : header.UniquePartName;
                binding.Message = messageName;
                binding.Use     = isEncoded ? SoapBindingUse.Encoded : SoapBindingUse.Literal;
                if (isEncoded)
                {
                    binding.Encoding = XmlSerializerOperationFormatter.GetEncoding(this.soapVersion);
                }
            }
示例#4
0
            private void ExportMessageBodyBinding(MessageDescription messageDescription, bool isRpc, bool isEncoded, MessageBinding messageBinding)
            {
                SoapBodyBinding binding = SoapHelper.GetOrCreateSoapBodyBinding(this.endpointContext, messageBinding, this.exporter);

                if (binding != null)
                {
                    binding.Use = isEncoded ? SoapBindingUse.Encoded : SoapBindingUse.Literal;
                    if (isRpc)
                    {
                        string wrapperNamespace;
                        if (!this.ExportedMessages.WrapperNamespaces.TryGetValue(new MessageContractExporter.MessageDescriptionDictionaryKey(this.endpointContext.ContractConversionContext.Contract, messageDescription), out wrapperNamespace))
                        {
                            wrapperNamespace = messageDescription.Body.WrapperNamespace;
                        }
                        binding.Namespace = wrapperNamespace;
                    }
                    if (isEncoded)
                    {
                        binding.Encoding = XmlSerializerOperationFormatter.GetEncoding(this.soapVersion);
                    }
                }
            }