コード例 #1
0
            internal void ExportMessageBinding(OperationDescription operation, Type messageContractExporterType)
            {
                bool             flag;
                bool             flag2;
                OperationBinding operationBinding = this.endpointContext.GetOperationBinding(operation);

                if (GetStyleAndUse(operation, messageContractExporterType, out flag, out flag2))
                {
                    SoapOperationBinding binding2 = SoapHelper.GetOrCreateSoapOperationBinding(this.endpointContext, operation, this.exporter);
                    if (binding2 != null)
                    {
                        binding2.Style = flag ? SoapBindingStyle.Rpc : SoapBindingStyle.Document;
                        if (flag)
                        {
                            SoapBinding binding3 = (SoapBinding)this.endpointContext.WsdlBinding.Extensions.Find(typeof(SoapBinding));
                            binding3.Style = binding2.Style;
                        }
                        binding2.SoapAction = operation.Messages[0].Action;
                        foreach (MessageDescription description in operation.Messages)
                        {
                            Message        message;
                            MessageBinding messageBinding = this.endpointContext.GetMessageBinding(description);
                            if (this.exportedMessages.WsdlHeaderMessages.TryGetValue(new MessageContractExporter.MessageDescriptionDictionaryKey(this.endpointContext.Endpoint.Contract, description), out message))
                            {
                                XmlQualifiedName messageName = new XmlQualifiedName(message.Name, message.ServiceDescription.TargetNamespace);
                                foreach (MessageHeaderDescription description2 in description.Headers)
                                {
                                    if (!description2.IsUnknownHeaderCollection)
                                    {
                                        this.ExportMessageHeaderBinding(description2, messageName, flag2, messageBinding);
                                    }
                                }
                            }
                            this.ExportMessageBodyBinding(description, flag, flag2, messageBinding);
                        }
                        foreach (FaultDescription description3 in operation.Faults)
                        {
                            this.ExportFaultBinding(description3, flag2, operationBinding);
                        }
                    }
                }
            }
コード例 #2
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);
                    }
                }
            }
コード例 #3
0
            private static XmlElement ConvertSoapFaultBinding(XmlElement src, EnvelopeVersion version)
            {
                XmlElement element;

                if (src != null)
                {
                    if (version == EnvelopeVersion.Soap12)
                    {
                        if (src.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/soap12/")
                        {
                            return(src);
                        }
                        goto Label_003F;
                    }
                    if (version == EnvelopeVersion.Soap11)
                    {
                        if (src.NamespaceURI == "http://schemas.xmlsoap.org/wsdl/soap/")
                        {
                            return(src);
                        }
                        goto Label_003F;
                    }
                }
                return(null);

Label_003F:
                element = SoapHelper.CreateSoapFaultBinding(version);
                if (src.HasAttributes)
                {
                    foreach (System.Xml.XmlAttribute attribute in src.Attributes)
                    {
                        element.SetAttribute(attribute.Name, attribute.Value);
                    }
                }
                return(element);
            }
コード例 #4
0
 private void ExportFaultBinding(FaultDescription fault, bool isEncoded, OperationBinding operationBinding)
 {
     SoapHelper.CreateSoapFaultBinding(fault.Name, this.endpointContext, this.endpointContext.GetFaultBinding(fault), isEncoded);
 }