I have a normal WCF service that is exposed as a SOAP service and I need to secure it with an ApiKey that will be provided in either the HTTP header or as a HTTP query parameter. Both the retrieval of the WSDL and the consuming of the web service must be protected but this ApiKey. Finally, if validation fails, an empty document with an HTTP status code must be returned.
I have tried various stuff using behaviors but the best effort only secured the consuming part and I was unable to return an empty document (always returned a SOAP fault XML document with my exception details). I have not been able to intercept the WSDL generation and return 401/403 HTTP status code.
I realize this is non-standard, but this is how the requirements are presented to me.
I assume this is possible, but I am at a loss.
The project basically only has 1 .cs file containing the required interface and the implementation thereof:
[ServiceContract]
public interface IFooService
{
[OperationContract]
barOut Lookup(string baz);
}
If anyone has done this, I'd like to get some pointers.