Skip to content

Not able to consume a WCF service with CustomBinding endpoint with messageversion as Soap12 #2711

Closed
@ranjitkrishnan

Description

@ranjitkrishnan

I have to consumer a WCF service from my Core2.0 API. The WCF service has custombiding with messageVersion as Soap12.

Please find the wcf service binding configuration.

<customBinding>
        <binding closeTimeout="00:10:00" openTimeout="00:10:00" sendTimeout="00:10:00">
          <textMessageEncoding  messageVersion ="Soap12">
            <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          </textMessageEncoding>
          <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" useDefaultWebProxy="true" transferMode="Buffered" />
        </binding>
      </customBinding>

I am using System.ServiceModel.Primitives to create the CustomBinding from my .NET Core Code.

Please find the code below

           
            var binding = new CustomBinding();
TextMessageEncodingBindingElement textBindingElement = new TextMessageEncodingBindingElement
            {
                MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None),
                WriteEncoding = System.Text.Encoding.UTF8,
                ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max
            };

            binding.Elements.Add(textBindingElement);

            HttpTransportBindingElement httpBindingElement = new System.ServiceModel.Channels.HttpTransportBindingElement
            {
                AllowCookies = false,
                MaxBufferSize = int.MaxValue,
                MaxReceivedMessageSize = int.MaxValue,
                TransferMode= TransferMode.Buffered
            };
            binding.Elements.Add(httpBindingElement);

I am getting the below error from this call.

ActionNotSupportedException: The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None)

This will work for any other message version like Soap11, Soap12WSAddressing10 which is directly present in MessageVersion class. It is not working when i am creating messageversion using CreateVersion method as there is no in-built support for Soap12 as it used to be with the framewrok dll

Metadata

Metadata

Assignees

Labels

bugThis is a product bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions