Exemple #1
0
        public static IApplicationBuilder UseSoapEndpoint <T_MESSAGE>(this IApplicationBuilder builder, Type type, string path, Binding binding, SoapSerializer serializer = SoapSerializer.DataContractSerializer, bool caseInsensitivePath = false, ISoapModelBounder soapModelBounder = null)
            where T_MESSAGE : CustomMessage, new()
        {
            var elements       = binding.CreateBindingElements().FindAll <MessageEncodingBindingElement>();
            var encoderOptions = new SoapEncoderOptions[elements.Count];

            for (var i = 0; i < encoderOptions.Length; i++)
            {
                var encoderOption = new SoapEncoderOptions
                {
                    MessageVersion = elements[i].MessageVersion,
                    WriteEncoding  = Encoding.UTF8,
                    ReaderQuotas   = XmlDictionaryReaderQuotas.Max
                };

                if (elements[i] is TextMessageEncodingBindingElement textMessageEncodingBindingElement)
                {
                    encoderOption.WriteEncoding = textMessageEncodingBindingElement.WriteEncoding;
                    encoderOption.ReaderQuotas  = textMessageEncodingBindingElement.ReaderQuotas;
                }

                encoderOptions[i] = encoderOption;
            }

            return(builder.UseSoapEndpoint <T_MESSAGE>(type, path, encoderOptions, serializer, caseInsensitivePath, soapModelBounder, binding));
        }
Exemple #2
0
        public static IEndpointConventionBuilder UseSoapEndpoint <T, T_MESSAGE>(this IEndpointRouteBuilder routes, Action <SoapCoreOptions> options)
            where T_MESSAGE : CustomMessage, new()
        {
            var opt = new SoapCoreOptions();

            options(opt);

            // Generate encoders from Binding when they are not provided
            if (opt.EncoderOptions is null && opt.Binding != null)
            {
                var elements       = opt.Binding.CreateBindingElements().FindAll <MessageEncodingBindingElement>();
                var encoderOptions = new SoapEncoderOptions[elements.Count];

                for (var i = 0; i < encoderOptions.Length; i++)
                {
                    var encoderOption = new SoapEncoderOptions
                    {
                        MessageVersion = elements[i].MessageVersion,
                        WriteEncoding  = Encoding.UTF8,
                        ReaderQuotas   = XmlDictionaryReaderQuotas.Max
                    };

                    if (elements[i] is TextMessageEncodingBindingElement textMessageEncodingBindingElement)
                    {
                        encoderOption.WriteEncoding = textMessageEncodingBindingElement.WriteEncoding;
                        encoderOption.ReaderQuotas  = textMessageEncodingBindingElement.ReaderQuotas;
                    }

                    encoderOptions[i] = encoderOption;
                }

                opt.EncoderOptions = encoderOptions;
            }

            var soapOptions = new SoapOptions
            {
                ServiceType         = typeof(T),
                Path                = opt.Path,
                HttpsGetEnabled     = opt.HttpsGetEnabled,
                HttpGetEnabled      = opt.HttpGetEnabled,
                Binding             = opt.Binding,
                CaseInsensitivePath = opt.CaseInsensitivePath,
                EncoderOptions      = opt.EncoderOptions,
                SoapModelBounder    = opt.SoapModelBounder,
                SoapSerializer      = opt.SoapSerializer,
                BufferLimit         = opt.BufferLimit,
                BufferThreshold     = opt.BufferThreshold,
                OmitXmlDeclaration  = opt.OmitXmlDeclaration,
                IndentXml           = opt.IndentXml
            };

            var pipeline = routes
                           .CreateApplicationBuilder()
                           .UseMiddleware <SoapEndpointMiddleware <T_MESSAGE> >(soapOptions)
                           .Build();

            return(routes.Map(soapOptions.Path, pipeline)
                   .WithDisplayName("SoapCore"));
        }
Exemple #3
0
        public static IApplicationBuilder UseSoapEndpoint <T>(this IApplicationBuilder builder, Action <SoapCoreOptions> options)
        {
            var opt = new SoapCoreOptions();

            options(opt);

            // Generate encoders from Binding when they are not provided
            if (opt.EncoderOptions is null && opt.Binding != null)
            {
                var elements       = opt.Binding.CreateBindingElements().FindAll <MessageEncodingBindingElement>();
                var encoderOptions = new SoapEncoderOptions[elements.Count];

                for (var i = 0; i < encoderOptions.Length; i++)
                {
                    var encoderOption = new SoapEncoderOptions
                    {
                        MessageVersion = elements[i].MessageVersion,
                        WriteEncoding  = Encoding.UTF8,
                        ReaderQuotas   = XmlDictionaryReaderQuotas.Max
                    };

                    if (elements[i] is TextMessageEncodingBindingElement textMessageEncodingBindingElement)
                    {
                        encoderOption.WriteEncoding = textMessageEncodingBindingElement.WriteEncoding;
                        encoderOption.ReaderQuotas  = textMessageEncodingBindingElement.ReaderQuotas;
                    }

                    encoderOptions[i] = encoderOption;
                }

                opt.EncoderOptions = encoderOptions;
            }

            var soapOptions = new SoapOptions
            {
                ServiceType         = typeof(T),
                Path                = opt.Path,
                HttpsGetEnabled     = opt.HttpsGetEnabled,
                HttpGetEnabled      = opt.HttpGetEnabled,
                Binding             = opt.Binding,
                CaseInsensitivePath = opt.CaseInsensitivePath,
                EncoderOptions      = opt.EncoderOptions,
                SoapModelBounder    = opt.SoapModelBounder,
                SoapSerializer      = opt.SoapSerializer,
                BufferThreshold     = opt.BufferThreshold,
                BufferLimit         = opt.BufferLimit
            };

            return(builder.UseMiddleware <SoapEndpointMiddleware>(soapOptions));
        }
Exemple #4
0
        public static IEndpointConventionBuilder UseSoapEndpoint <T, T_MESSAGE>(this IEndpointRouteBuilder routes, Action <SoapCoreOptions> options)
            where T_MESSAGE : CustomMessage, new()
        {
            var opt = new SoapCoreOptions();

            options(opt);

            // Generate encoders from Binding when they are not provided
            if (opt.EncoderOptions is null && opt.Binding != null)
            {
                var elements       = opt.Binding.CreateBindingElements().FindAll <MessageEncodingBindingElement>();
                var encoderOptions = new SoapEncoderOptions[elements.Count];

                for (var i = 0; i < encoderOptions.Length; i++)
                {
                    var encoderOption = new SoapEncoderOptions
                    {
                        MessageVersion = elements[i].MessageVersion,
                        WriteEncoding  = Encoding.UTF8,
                        ReaderQuotas   = XmlDictionaryReaderQuotas.Max
                    };

                    if (elements[i] is TextMessageEncodingBindingElement textMessageEncodingBindingElement)
                    {
                        encoderOption.WriteEncoding = textMessageEncodingBindingElement.WriteEncoding;
                        encoderOption.ReaderQuotas  = textMessageEncodingBindingElement.ReaderQuotas;
                    }

                    encoderOptions[i] = encoderOption;
                }

                opt.EncoderOptions = encoderOptions;
            }

            var soapOptions = SoapOptions.FromSoapCoreOptions <T>(opt);

            var pipeline = routes
                           .CreateApplicationBuilder()
                           .UseMiddleware <SoapEndpointMiddleware <T_MESSAGE> >(soapOptions)
                           .Build();

            return(routes.Map(soapOptions.Path, pipeline)
                   .WithDisplayName("SoapCore"));
        }
Exemple #5
0
 public static IApplicationBuilder UseSoapEndpoint <T_MESSAGE>(this IApplicationBuilder builder, Type type, string path, SoapEncoderOptions encoder, SoapSerializer serializer = SoapSerializer.DataContractSerializer, bool caseInsensitivePath = false, ISoapModelBounder soapModelBounder = null, Binding binding = null)
     where T_MESSAGE : CustomMessage, new()
 {
     return(builder.UseSoapEndpoint <T_MESSAGE>(type, path, new[] { encoder }, serializer, caseInsensitivePath, soapModelBounder, binding));
 }
Exemple #6
0
 public static IEndpointConventionBuilder UseSoapEndpoint(this IEndpointRouteBuilder routes, Type type, string path, SoapEncoderOptions encoder, SoapSerializer serializer = SoapSerializer.DataContractSerializer, bool caseInsensitivePath = false, ISoapModelBounder soapModelBounder = null, Binding binding = null)
 {
     return(routes.UseSoapEndpoint(type, path, new[] { encoder }, serializer, caseInsensitivePath, soapModelBounder, binding));
 }
Exemple #7
0
 public static IApplicationBuilder UseSoapEndpoint <T>(this IApplicationBuilder builder, string path, SoapEncoderOptions encoder, SoapSerializer serializer = SoapSerializer.DataContractSerializer, bool caseInsensitivePath = false, ISoapModelBounder soapModelBounder = null)
 {
     return(builder.UseSoapEndpoint(typeof(T), path, new[] { encoder }, serializer, caseInsensitivePath, soapModelBounder, null));
 }
Exemple #8
0
 public static IEndpointConventionBuilder UseSoapEndpoint <T, T_MESSAGE>(this IEndpointRouteBuilder routes, string path, SoapEncoderOptions encoder, SoapSerializer serializer = SoapSerializer.DataContractSerializer, bool caseInsensitivePath = false, ISoapModelBounder soapModelBounder = null)
     where T_MESSAGE : CustomMessage, new()
 {
     return(routes.UseSoapEndpoint <T_MESSAGE>(typeof(T), path, new[] { encoder }, serializer, caseInsensitivePath, soapModelBounder, null));
 }
 public static IApplicationBuilder UseSoapEndpoint(this IApplicationBuilder builder, Type type, string path, SoapEncoderOptions encoder, SoapSerializer serializer = SoapSerializer.DataContractSerializer, bool caseInsensitivePath = false, ISoapModelBounder soapModelBounder = null, Binding binding = null, bool indentXml = true, bool omitXmlDeclaration = true)
 {
     return(builder.UseSoapEndpoint(type, path, new[] { encoder }, serializer, caseInsensitivePath, soapModelBounder, binding, null, indentXml, omitXmlDeclaration));
 }
 public static IApplicationBuilder UseSoapEndpoint <T, T_MESSAGE>(this IApplicationBuilder builder, string path, SoapEncoderOptions encoder, SoapSerializer serializer = SoapSerializer.DataContractSerializer, bool caseInsensitivePath = false, ISoapModelBounder soapModelBounder = null, bool indentXml = true, bool omitXmlDeclaration = true)
     where T_MESSAGE : CustomMessage, new()
 {
     return(builder.UseSoapEndpoint <T_MESSAGE>(typeof(T), path, new[] { encoder }, serializer, caseInsensitivePath, soapModelBounder, null, null, indentXml, omitXmlDeclaration));
 }
 public static IEndpointConventionBuilder UseSoapEndpoint <T_MESSAGE>(this IEndpointRouteBuilder routes, Type type, string path, SoapEncoderOptions encoder, SoapSerializer serializer = SoapSerializer.DataContractSerializer, bool caseInsensitivePath = false, ISoapModelBounder soapModelBounder = null, Binding binding = null, WsdlFileOptions wsdlFileOptions = null, bool indentXml = true, bool omitXmlDeclaration = true)
     where T_MESSAGE : CustomMessage, new()
 {
     return(routes.UseSoapEndpoint <T_MESSAGE>(type, path, new[] { encoder }, serializer, caseInsensitivePath, soapModelBounder, binding, wsdlFileOptions, indentXml, omitXmlDeclaration));
 }
 public static IEndpointConventionBuilder UseSoapEndpoint <T>(this IEndpointRouteBuilder routes, string path, SoapEncoderOptions encoder, SoapSerializer serializer = SoapSerializer.DataContractSerializer, bool caseInsensitivePath = false, ISoapModelBounder soapModelBounder = null, WsdlFileOptions wsdlFileOptions = null, bool indentXml = true, bool omitXmlDeclaration = true)
 {
     return(routes.UseSoapEndpoint(typeof(T), path, new[] { encoder }, serializer, caseInsensitivePath, soapModelBounder, null, wsdlFileOptions, indentXml, omitXmlDeclaration));
 }