I am trying to consume a secure WCF service with PHP, and I can't figure out the syntax. I thought it would be as simple as following:
$client = new SoapClient('https://localhost/service.svc?wsdl', array('userName' => "test", "password" => 'pass'));
but instead it raises an exception An error occurred when verifying security for the message.
in PHP, and I get the following from Application Log MessageSecurityException: Security processor was unable to find a security header in the message. This might be because the message is an unsecured fault or because there is a binding mismatch between the communicating parties. This can occur if the service is configured for security and the client is not using security.
It seems to raise this error regardless of whether I try to supply credentials or not, so I unless I'm getting the syntax wrong, it's not that.
I've seen a few posts around that also blame the header, but I can't really figure out how to specify one, not to mention what it should be.
It's worth mentioning that I can consume the service successfully, as long as it's unsecured. I can also consume it successfully in any mode with a .NET client.