【问题标题】:soapUI With WCF Message Security带有 WCF 消息安全性的soapUI
【发布时间】:2011-09-29 22:08:08
【问题描述】:

我正在尝试配置我的 WCF (.NET 4.0) 服务,以便可以使用soapUI 对其进行测试。我正在使用具有消息安全性的 wsHttpBinding。我的目标是在公共测试端点上公开服务并尝试使用使用soapUI 测试的loadUI 对其进行负载测试。为此,端点需要是安全的,并且由于我的生产端点将使用消息安全性,我认为我的测试也应该使用它以实现接近生产负载测试结果。

我似乎无法配置soapUI 以成功调用服务。我尝试了多种使用客户端和服务器证书对输入和输出进行签名和加密的组合。有没有人成功实现了 WCF 和soapUI 的消息安全配置?

以下是我的配置摘录:

绑定:

  <wsHttpBinding>

            <binding name="MessageSecurity">
                <security mode="Message">
                    <message clientCredentialType="Certificate" negotiateServiceCredential="false"/>
                </security>
            </binding>

        </wsHttpBinding>

行为

    <behaviors>
        <serviceBehaviors>
            <behavior name="customBehavior">
                <serviceMetadata httpGetEnabled="True"/>
                <serviceDebug includeExceptionDetailInFaults="True"/>

                <serviceCredentials>
                    <clientCertificate>
                        <authentication certificateValidationMode="PeerTrust"/>
                    </clientCertificate>
                    <serviceCertificate findValue="MyWebServicesCertificate" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/>
                </serviceCredentials>
            </behavior>
        </serviceBehaviors>

        <endpointBehaviors>
            <behavior name="webHttp">
                <webHttp/>
            </behavior>
        </endpointBehaviors>

    </behaviors>
</system.serviceModel>

服务:

            <service behaviorConfiguration="customBehavior" name="MyService">

            <!-- Service Endpoint -->
            <endpoint name="Production" address="" binding="wsHttpBinding" bindingConfiguration="MessageSecurity" contract="IMyService">

                <identity>
                    <dns value="web_services_svr"/>
                </identity>
            </endpoint>




            <host>
                <baseAddresses>
                    <add baseAddress="http://web_services_svr/MyService.svc" />
                </baseAddresses>
            </host>

        </service>

【问题讨论】:

  • 您从 SOAPUI 尝试连接时得到的具体错误是什么?
  • 尝试从控制台应用程序调用服务。使用 fiddler 捕获请求和响应并进行验证。

标签: wcf wcf-security soapui


【解决方案1】:

将negotiateServiceCredential 设置为false,并将建立SecuritySession 设置为false。

在这种互操作性之后是可能的。如果您在合约上添加 ProtectionLecel.Sign(例如,不加密),那就更容易了。

【讨论】:

  • +1:这是一个很好的建议,但它仍然不想工作。在我将negotiateServiceCredentialestablishSecuritySession 设置为false 后,WCF 跟踪日志中出现另一个错误-“没有通道可以接受带有操作'schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue' 的消息。”
  • 如果您将两者都设置为 false,那么在 soapui 中也不需要任何安全性
【解决方案2】:

您可能需要检查几件事。

1) 设置negotiateServiceCredential="false"

<wsHttpBinding>
   <binding name="wsHttpSecure">
      <security mode="Message">
         <message clientCredentialType="UserName" negotiateServiceCredential="false"    
                  establishSecurityContext="false" algorithmSuite="Default" />
      </security>
   </binding>
</wsHttpBinding>

2) 还要确保在 SOAP UI 中勾选“将默认 WSA 添加到”

检查此链接 http://ddkonline.blogspot.com.br/2012/10/wcf-45-host-unreachable-when-calling.html

3) 用于通过以下链接的客户端证书检查

http://www.soapui.org/SOAP-and-WSDL/applying-ws-security.html

我希望这会有所帮助。

【讨论】:

    【解决方案3】:

    遇到同样的问题。

    最终放弃了安全措施 - WCF : soapUI error "BadContextToken"

    【讨论】:

      【解决方案4】:

      存在 Web 代理的网络中的 SoapUI 存在问题。假设没有其他问题,您必须在 SoapUI 中配置代理设置才能使其正常工作。

      【讨论】:

        【解决方案5】:

        尝试使用 firefox 插件或 curl 进行调用。如果您可以使用任何工具成功运行调用,请尝试复制请求并从soapUI 运行它。如果调用使用任何其他工具,它应该在soapUI中也能正常工作,除非你进行soap/tcp调用

        【讨论】:

          猜你喜欢
          • 2013-09-06
          • 2011-07-08
          • 1970-01-01
          • 2012-03-01
          • 2010-10-04
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多