Authenticate a IIS Hosted WCF Service from a PHP Soap Client?
I have a wcf service that is hosted in IIS 7. I have a php soap client that I want to use to access this service. It works fine with no security, but I want to be able to pass the username and password from the php client to the wcf service and have it authenticated through my custom username validator. I am not a php developer, so I am unaware of how to actually send the username and password to the service and have the custom username and password validator retreive the username and password and validate it. Here is code for the php client:
<?php
header('Content-Type: text/plain');
// Create a new soap client based on the service's metadata (WSDL)
$client = new SoapClient('http://localhost:88/ColorService.svc?wsdl',array);
$obj = array("colorId" => 2405);
$retval = $client->__soapCall('GetColorInfo',array($obj));
?>
Here is the basicHttpBinding configuration in my wcf web.config. Again, I am not sure if t开发者_Python百科his is correct in order to get a username/password from a php client to a wcf service.
<basicHttpBinding>
<binding name="Basic">
<security mode="TransportCredentialOnly">
</security>
</binding>
</basicHttpBinding>
Note, if I put clientCredentialType="Basic", IIS wants me to enable Basic authentication, but I don't want authentication through IIS, I want authentication through the service, specifically handled by the custom username and password validator.
精彩评论