Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 如何让SoapUI使用ws-security模式';使用MessageCredential和x27进行传输;_.net_Wcf_Soapui_Ws Security - Fatal编程技术网

.net 如何让SoapUI使用ws-security模式';使用MessageCredential和x27进行传输;

.net 如何让SoapUI使用ws-security模式';使用MessageCredential和x27进行传输;,.net,wcf,soapui,ws-security,.net,Wcf,Soapui,Ws Security,我试图在SoapUI中创建一个示例请求,但我不确定如何让它工作 这是C#中的一个工作示例: 配置: <system.serviceModel> <bindings> <wsHttpBinding> <binding name="WSHttpBinding_IMyService"> <security mode="TransportWithMessageCredential">

我试图在SoapUI中创建一个示例请求,但我不确定如何让它工作

这是C#中的一个工作示例:

配置:

  <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>

  <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中实现这一点似乎不难,但我不断地遇到各种各样的错误


有人有这样的工作示例吗?

双击端点信息进入客户端端点的属性,添加用户名/密码凭据,并将WSS类型更改为PasswordText。如下所示。

此外,由于传输层的安全性,当客户端调用服务器的证书时,我们应该将其安装在受信任的根证书颁发机构中。

如果有什么我可以帮忙的,请随时告诉我。

通过在wcf配置中禁用“establishSecurityContext”解决了这个问题。这样做之后,SoapUI就可以打电话了

配置:

  <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>

  <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总是需要吗?SoapUI似乎不支持这种安全类型的wshttpbinding。因此它会自动生成basichttpbinding端点。在我这方面,当我使用basichttpbinding发布服务时,它就起作用了。在互联网上搜索了一些信息后,我仍然无法让它工作。请尝试参考以下链接。