从 PHP Soap 客户端验证 IIS 托管的 WCF 服务?
我有一个托管在 IIS 7 中的 wcf 服务。我有一个 php Soap 客户端,我想用它来访问此服务。它在没有安全性的情况下工作正常,但我希望能够将用户名和密码从 php 客户端传递到 wcf 服务,并通过我的自定义用户名验证器对其进行身份验证。我不是 php 开发人员,所以我不知道如何实际将用户名和密码发送到服务,并让自定义用户名和密码验证器检索用户名和密码并验证它。这是 php 客户端的代码:
<?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));
?>
这是我的 wcf web.config 中的 basicHttpBinding 配置。再次,我不确定这是否正确,以便从 php 客户端获取用户名/密码到 wcf 服务。
<basicHttpBinding>
<binding name="Basic">
<security mode="TransportCredentialOnly">
</security>
</binding>
</basicHttpBinding>
请注意,如果我设置 clientCredentialType="Basic",IIS 希望我启用基本身份验证,但我不想通过 IIS 进行身份验证,我希望通过服务进行身份验证,具体由自定义用户名和密码验证器处理。
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 this 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论