如何让 SoapUI 与 ws-security 模式一起工作 'TransportWithMessageCredential'
How to get SoapUI to work with ws-security mode 'TransportWithMessageCredential'
我正在尝试在 SoapUI 中创建示例请求,但我不确定如何让它工作。
这是 C# 中的一个工作示例:
var myService = new MyServiceClient("WSHttpBinding_MyService");
myService .ClientCredentials.UserName.UserName = "User";
myService .ClientCredentials.UserName.Password = "Password";
var response = myService.MyMethod("parameter1");
配置:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IMyService">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://myWebsite.com:8000/MyService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMyService"
contract="MyService.IMyService" name="WSHttpBinding_IMyService" />
</client>
</system.serviceModel>
似乎在 SoapUI 中让它工作应该不难,但我不断收到各种错误。
有人有这方面的工作示例吗?
双击端点信息进入客户端的属性,添加Username/password凭证并将WSS-Type更改为PasswordText.如下图
此外,由于传输层的安全性,我们应该在客户端调用它时将服务器的证书安装在受信任的根证书颁发机构中。
如果有什么我可以帮忙的,请随时告诉我。
通过在 wcf 配置中禁用 'establishSecurityContext' 解决了这个问题。这样做之后,SoapUI 就可以进行调用了。
配置:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IMyService">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" negotiateServiceCredential="true"
establishSecurityContext="false" algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://myWebsite.com:8000/MyService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMyService"
contract="MyService.IMyService" name="WSHttpBinding_IMyService" />
</client>
</system.serviceModel>
并选中 SoapUI 中的 wsa:To 框以使其正常工作:
我正在尝试在 SoapUI 中创建示例请求,但我不确定如何让它工作。
这是 C# 中的一个工作示例:
var myService = new MyServiceClient("WSHttpBinding_MyService");
myService .ClientCredentials.UserName.UserName = "User";
myService .ClientCredentials.UserName.Password = "Password";
var response = myService.MyMethod("parameter1");
配置:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IMyService">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://myWebsite.com:8000/MyService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMyService"
contract="MyService.IMyService" name="WSHttpBinding_IMyService" />
</client>
</system.serviceModel>
似乎在 SoapUI 中让它工作应该不难,但我不断收到各种错误。
有人有这方面的工作示例吗?
双击端点信息进入客户端的属性,添加Username/password凭证并将WSS-Type更改为PasswordText.如下图
此外,由于传输层的安全性,我们应该在客户端调用它时将服务器的证书安装在受信任的根证书颁发机构中。
如果有什么我可以帮忙的,请随时告诉我。
通过在 wcf 配置中禁用 'establishSecurityContext' 解决了这个问题。这样做之后,SoapUI 就可以进行调用了。
配置:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IMyService">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" negotiateServiceCredential="true"
establishSecurityContext="false" algorithmSuite="Default" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://myWebsite.com:8000/MyService.svc"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IMyService"
contract="MyService.IMyService" name="WSHttpBinding_IMyService" />
</client>
</system.serviceModel>
并选中 SoapUI 中的 wsa:To 框以使其正常工作: