Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

soapUI With WCF Message Security

I am trying to configure my WCF (.NET 4.0) service so that it can be tested using soapUI. I am using wsHttpBinding with message security. My goal is to expose the service on a public test endpoint and try to load-test it with loadUI which uses soapUI tests. 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. I have tried a number of combinations of signing and encrypting input and output with the client and server certificate. Has anybody managed to achieve a successful message security configuration of WCF and 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>
like image 603
Milen Avatar asked Jul 06 '11 19:07

Milen


People also ask

What is WCF message security?

Windows Communication Foundation (WCF) is a SOAP message-based distributed programming platform, and securing messages between clients and services is essential to protecting data.

Can we test WCF service in SoapUI?

No need to have a WCF . NET Client as of now to test and monitor HTTP traffic of WCF service calls. Open soapUI and set the following settings. Make sure the service's wsdl path is correct.

How will you implement basic authentication in WCF service?

To be able to integrate Basic Authentication with WCF REST, we have to extend the functionality of the WCF framework. The extension is divided into three steps: Find the extension point to apply behavior to all operations of the service. Create a custom authentication mechanism based on existing standards.


2 Answers

set negotiateServiceCredential to false and also establishSecuritySession to false.

after this interoperability is possible. If you add ProtectionLecel.Sign on your contracts (e.g. do not encrypt) it is even easier.

like image 120
Yaron Naveh Avatar answered Oct 19 '22 18:10

Yaron Naveh


You might want to check for few things.

1) Set 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"

Check this link http://ddkonline.blogspot.com.br/2012/10/wcf-45-host-unreachable-when-calling.html

3) For passing client certificate check following link

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

I hope that helps.

like image 30
dshah1302 Avatar answered Oct 19 '22 18:10

dshah1302