简体   繁体   English

带有 WCF 消息安全的soapUI

[英]soapUI With WCF Message Security

I am trying to configure my WCF (.NET 4.0) service so that it can be tested using soapUI.我正在尝试配置我的 WCF (.NET 4.0) 服务,以便可以使用soapUI对其进行测试。 I am using wsHttpBinding with message security.我正在使用具有消息安全性的 wsHttpBinding。 My goal is to expose the service on a public test endpoint and try to load-test it with loadUI which uses soapUI tests.我的目标是在公共测试端点上公开服务,并尝试使用使用soapUI 测试的loadUI 对其进行负载测试。 For this to work the endpoint needs to be secure and since my production endpoint will use message security I figure my test one should also use it in order to achieve close to production load test results.为此,端点需要是安全的,并且由于我的生产端点将使用消息安全性,我认为我的测试一个也应该使用它以实现接近生产负载测试结果。

I can't seem to be able to configure soapUI to successfully call the service.我似乎无法配置soapUI 以成功调用该服务。 I have tried a number of combinations of signing and encrypting input and output with the client and server certificate.我已经尝试了多种签名和加密输入以及 output 与客户端和服务器证书的组合。 Has anybody managed to achieve a successful message security configuration of WCF and soapUI?有没有人成功实现了 WCF 和soapUI 的消息安全配置?

The following are exerpts from my configuration:以下是我的配置的摘录:

Binding:捆绑:

  <wsHttpBinding>

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

        </wsHttpBinding>

Behavior行为

    <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:服务:

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

set negotiateServiceCredential to false and also establishSecuritySession to false.将negotiateServiceCredential 设置为false,并将建立SecuritySession 设置为false。

after this interoperability is possible.在这种互操作性成为可能之后。 If you add ProtectionLecel.Sign on your contracts (eg do not encrypt) it is even easier.如果您在您的合同上添加 ProtectionLecel.Sign(例如不加密),那就更容易了。

You might want to check for few things.你可能想检查几件事。

1) Set negotiateServiceCredential="false" 1)设置negotiateServiceCredential="false"

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

2) Also make sure in SOAP UI you check mark "Add default WSA To" 2) 还要确保在 SOAP UI 中勾选“将默认 WSA 添加到”

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

3) For passing client certificate check following link 3)通过客户端证书检查以下链接

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

I hope that helps.我希望这会有所帮助。

There is an issue with SoapUI in a network where there is a web proxy.在存在 web 代理的网络中,SoapUI 存在问题。 You must configure the proxy settings in SoapUI to get this to work, assuming there was no other problem.假设没有其他问题,您必须在 SoapUI 中配置代理设置才能使其正常工作。

Try making the call using firefox plugin or curl.尝试使用 firefox 插件或 curl 拨打电话。 If you can get the call running successfuly using any tool, try to copy the request and run it from soapUI.如果您可以使用任何工具成功运行调用,请尝试复制请求并从soapUI 运行它。 If the call works using any other tool, it should work as well in soapUI unless you making soap/tcp call如果调用使用任何其他工具,它应该在soapUI中也能正常工作,除非你进行soap/tcp调用

Had the same problem.有同样的问题。

Eventually gave up and took the security out - WCF: soapUI error "BadContextToken"最终放弃并采取了安全措施 - WCF:soapUI 错误“BadContextToken”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM