0

I have a WCF application that is currently running in SOAP configuration, and I need to convert it to REST.

In theory, I have it working, but when I call the RST API using curl, I get an error:

curl -v http://localhost:8853/ClearCore/SecMyPermissions

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).

The bit where it says "Action '' cannot be processed" suggest to me that I've got the configuration wrong in such a way that it's not recognising the function name is being passed in.

C++ Code

[ServiceContract]
[Guid("5098109F-DB33-44e6-87B8-1929C879515B")]
public interface class IClearCoreSoap
{
    [OperationContract]
    [FaultContract(Exception::typeid)]
    virtual List<System::String^>^ SecMyPermissions();
}

[ServiceBehavior(IncludeExceptionDetailInFaults = true, ConcurrencyMode = ConcurrencyMode::Multiple,
                 InstanceContextMode=InstanceContextMode::PerCall,
                 AddressFilterMode = AddressFilterMode::Any)]
public ref class ClearCoreSoap : IClearCoreSoap
{
public:
    virtual List<System::String^>^ SecMyPermissions();
}
System::ServiceModel::ServiceHost^ pServiceHost = gcnew System::ServiceModel::ServiceHost(ClearCoreSoap::typeid);
pServiceHost->Open();

WCF binding

<configuration>
    <system.serviceModel>
        <bindings>
            <webHttpBinding>
                <binding maxReceivedMessageSize="1000000" name="NoSecurity">
                    <readerQuotas maxDepth="1000000" maxStringContentLength="65535"/>
                </binding>
                <binding maxBufferSize="1000000" maxReceivedMessageSize="1000000" name="BasicSecurity">
                    <readerQuotas maxDepth="1000000" maxStringContentLength="65535"/>
                    <security mode="Transport"/>
                </binding>
            </webHttpBinding>
        </bindings>
        <services>
            <service behaviorConfiguration="webHttpBehavior" name="soapcon.ClearCoreSoap">
                <endpoint address="http://localhost:8853/ClearCore" binding="webHttpBinding" bindingConfiguration="NoSecurity" contract="soapcon.IClearCoreSoap" name="ClearCore"/>
                <host>
                    <baseAddresses>
                        <add baseAddress="http://localhost:8853/ClearCore"/>
                    </baseAddresses>
                </host>
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="webHttpBehavior">
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/>
                    <serviceCredentials type="System.ServiceModel.Description.ServiceCredentials">
                        <clientCertificate>
                            <authentication certificateValidationMode="None"/>
                        </clientCertificate>
                        <userNameAuthentication customUserNamePasswordValidatorType="soapcon.ADRetry_Validator, server_console_d" userNamePasswordValidationMode="Custom"/>
                    </serviceCredentials>
                </behavior>
            </serviceBehaviors>
            <endpointBehaviors>
                <behavior name="webHttpBehavior">
                    <webHttp/>
                </behavior>
            </endpointBehaviors>
        </behaviors>
    </system.serviceModel>
</configuration>
Simon Callan
  • 3,020
  • 1
  • 23
  • 34

1 Answers1

0

A "ContractFilter mismatch at the EndpointDispatcher" means the receiver could not process the message because it did not match any of the contracts the receiver has configured for the endpoint which received the message.

This can be because:

  • You have different contracts between client and sender.
  • You're using a different binding between client and sender.
  • The message security settings are not consistent between client and sender.

You can refer to this thread to solve the problem.
Based on the code you provided, you can try the following:

<endpoint address="http://localhost:8853/ClearCore" binding="webHttpBinding" bindingConfiguration="NoSecurity" contract="soapcon.IClearCoreSoap" name="ClearCore"/>
  • Try calling http://localhost:8853/ClearCore
  • Add behaviour configuration in <endpoint address /> tag
Lan Huang
  • 613
  • 2
  • 5