Home > Software Development > Consuming a Default WCF Service in SoapUI

Consuming a Default WCF Service in SoapUI

May 5th, 2010

When you create a WCF service (using the template in Visual Studio 2008) and try to test it in soapUI you get the following error:

The message could not be processed. This is most likely because the action ‘http://tempuri.org/IService1/GetData’ is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint’s binding.

The reason for this is that the default WCF binding (wsHttpBinding) implements a security context token which is not supported in soapUI.

To disable the security context token requirement in the binding add the following to your web-config:

<system.serviceModel>
  <bindings>
    <wsHttpBinding>
      <binding name="wsHttpBindingNoSCT">
        <security mode="None">
          <transport clientCredentialType="None" />
          <message establishSecurityContext="false" />
        </security>
      </binding>
    </wsHttpBinding>
  </bindings>
</system.serviceModel>

Then change the service endpoint configuration to use the new binding (set the bindingConfiguration to the name specified above):

<endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpBindingNoSCT" contract="WcfService1.IService1">

You should now be able to test this service using soapUI.

Note that you will have to check the “Add default was:To” in the WS-Addressing settings for the request in soapUI as the wsHttpBinding requires WS-Addressing action headers.

  1. Muhammad Farhan Jamil
    June 2nd, 2010 at 07:35 | #1

    Thanks alot. It solves my problem.

  2. Konstantin
    September 8th, 2010 at 07:42 | #2

    Thanks a lot! A very helpful post…

  3. October 29th, 2010 at 05:32 | #3

    Hi there,

    I was really happy someone obviously faces the same problem. Is was gong crazy thinking wheter nobody uses SoapUI with WCF?
    Still I’m stuck now. Instead of the exception you described I do get the following error instead:

    The message with To ‘{0}’ cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver’s EndpointAddresses agree.

    Do you have an idea what could be wrong?

    This is the relevant part of my web.config:

    <!---->


    <!--
    --><!--

    -->

    <!--

    -->

  4. October 29th, 2010 at 05:36 | #4

    Hi there,

    I was really happy someone obviously faces the same problem. Is was gong crazy thinking wheter nobody uses SoapUI with WCF?
    Still I’m stuck now. Instead of the exception you described I do get the following error instead:

    The message with To ‘{0}’ cannot be processed at the receiver, due to an AddressFilter mismatch at the EndpointDispatcher. Check that the sender and receiver’s EndpointAddresses agree.

    Do you have an idea what could be wrong?

    This is the relevant part of my web.config:

    (sorry, don’t know how to post this in this blog)

  5. Devika
    June 16th, 2011 at 01:58 | #5

    Solved my problem. Thank you..

  6. susha
    August 4th, 2011 at 03:07 | #6

    A very helpful post… Thank you Very much

  7. Camilo
    August 23rd, 2011 at 11:03 | #7

    Thanks man!

  8. Rajendra
    January 20th, 2012 at 07:34 | #8

    Hi, Thanks a lot for the wonderful piece of information…i have been doing a lot of research on my code thinking that there is something wrong with my code. Iam happy that i got the solution at last from your post, inspite of wasting a lot of time. Thank you once again. Keep the good work going :)

  9. January 29th, 2012 at 07:02 | #9

    Thank you this helped me with my project.

  10. Narayan sahu
    April 5th, 2012 at 09:21 | #10

    Its not working with WCF service using DataContract serialization.
    Does it work only with XML Serialization.

  11. Abhishek
    May 20th, 2012 at 23:50 | #11

    Thanks a lot. It worked for me

  12. Mursel
    August 30th, 2012 at 07:03 | #12

    Thanks to the sky! :)

  13. derek
    September 20th, 2012 at 08:48 | #13

    Thank you very much!

  14. Sumit
    November 16th, 2012 at 08:28 | #14

    “The reason for this is that the default WCF binding (wsHttpBinding) implements a security context token which is not supported in soapUI.”

    Could you please provide source that soapUI does not support message level security?

  15. November 21st, 2012 at 03:14 | #15

    @Rothi
    For sure you found the solution, but for future use look here:
    http://javiercrespoalvez.com/2010/09/using-soapui-to-consume-ws-addressing.html

  16. Tulasi
    December 30th, 2012 at 23:09 | #16

    Hi,
    I am using soapUI tool to test my wcf services.It is not working with WSHttpbinding.

    Please tell me how to test WSHttpbinding with soapUI tool.In some sites i find below solutions but not working
    SOLUTION1
    Please follow the steps as mentioned below:

    1.)Expose the service for the required Application with Wshttp bindings.

    2.)In web.config file add the binding information as given below:

    3.)Reset IIS

    4.)In SOAP UI Check Whether WS-A is enabled.
    Trigger a request in SOAP UI…U will get the corresponding response…
    IT IS NOT WORKING

    SOLUTION2

    [ServiceContract(SessionMode=SessionMode.Required)]

    In the above change to [ServiceContract(SessionMode=SessionMode.Allowed)] this is working. But i need to use Required Only

    How can i get rid of this problem ?

Comments are closed.