【问题标题】:How to get SoapUI to work with ws-security mode 'TransportWithMessageCredential'如何让 SoapUI 与 ws-security 模式“TransportWithMessageCredential”一起使用
【发布时间】:2019-05-15 08:39:11
【问题描述】:

我正在尝试在 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 中让它工作并不难,但我不断收到各种错误。

有人有这方面的工作示例吗?

【问题讨论】:

    标签: .net wcf soapui ws-security


    【解决方案1】:

    双击端点信息进入客户端端点属性,添加用户名/密码凭证并将WSS-Type更改为PasswordText。如下图。

    此外,由于传输层的安全性,我们应该在客户端调用它时将服务器的证书安装在受信任的根证书颁发机构中。
    如果有什么我可以帮忙的,请随时告诉我。

    【讨论】:

    • 我试过这个,但我不断收到以下错误:无法处理消息。这很可能是因为操作 'tempuri.org/MyService/GetRequestStatus' 不正确,或者因为消息包含无效或过期的安全上下文令牌,或者因为绑定之间不匹配......我没有安装服务器证书,是否始终需要对于 SoapUI?
    • soapUI 好像不支持这种安全类型的wshttpbinding。所以它会自动生成基本的httpbinding端点。就我而言,它在我使用 basichttpbinding 发布服务时起作用。在互联网上搜索了一些信息后,我仍然无法使其工作。尝试参考以下链接。stackoverflow.com/questions/13729270/…
    【解决方案2】:

    通过在 wcf 配置中禁用“建立安全上下文”解决了这个问题。之后,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 框以使其正常工作:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-02-21
      • 1970-01-01
      • 2015-05-13
      • 2020-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多