Example #1
0
        void IPolicyImportExtension.ImportPolicy(MetadataImporter importer,
                                                 PolicyConversionContext context)
        {
            var assertions = context.GetBindingAssertions();

            var mtom = PolicyImportHelper.GetMtomMessageEncodingPolicy(assertions);

            if (mtom != null)
            {
                // http://www.w3.org/Submission/WS-MTOMPolicy/
                context.BindingElements.Add(new MtomMessageEncodingBindingElement());
                return;
            }

            var binary = PolicyImportHelper.GetBinaryMessageEncodingPolicy(assertions);

            if (binary != null)
            {
                context.BindingElements.Add(new BinaryMessageEncodingBindingElement());
                return;
            }

            context.BindingElements.Add(new TextMessageEncodingBindingElement());
        }