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>