none
WCF wshttpbinding (SOAP 1.2) not working with SoapUI tool RRS feed

  • Question

  • I have a simple WCF (.NET 3.5) Service application which has the default code created by VS 2008 when i open a new project.
     
    I am having wshttpbinding with the following configuration in web.config file.

    <system.serviceModel>
        <services>
          <service name="WCFTestServiceApp.Service1" behaviorConfiguration="WCFTestServiceApp.Service1Behavior">
            <!-- Service Endpoints -->
            <endpoint address="" binding="wsHttpBinding" contract="WCFTestServiceApp.IService1" bindingConfiguration="binding1">
              <!-- 
                  Upon deployment, the following identity element should be removed or replaced to reflect the 
                  identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
                  automatically.
              -->
              <identity>
                <dns value="localhost"/>
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
          </service>
        </services>
        <bindings>
          <wsHttpBinding>
            <binding name="binding1">          
            </binding>
          </wsHttpBinding>
        </bindings>
        <behaviors>
          <serviceBehaviors>
            <behavior name="WCFTestServiceApp.Service1Behavior">
              <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
              <serviceMetadata httpGetEnabled="true"/>
              <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>

    I have run this WCF application and able to use VS 2008 WCFTESTCLIENT to send and recieve messages. I am not able to do the same with SoapUI tool. When i switch over to basichttpBinding it seems to work as its SOAP 1.1 version. But wsHttpBinding (SOAP 1.2) doesn't seem to work.
     
    following is the request and response messages i receive in SoapUI tool.
     
    Request

    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">
       <soap:Header/>
       <soap:Body>
          <tem:GetData>
             <!--Optional:-->
             <!--type: int-->
             <tem:value>3</tem:value>
          </tem:GetData>
       </soap:Body>
    </soap:Envelope>

    Response

    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
       <s:Header>
          <a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/soap/fault</a:Action>
       </s:Header>
       <s:Body>
          <s:Fault>
             <s:Code>
                <s:Value>s:Sender</s:Value>
                <s:Subcode>
                   <s:Value xmlns:a="http://schemas.xmlsoap.org/ws/2005/02/sc">a:BadContextToken</s:Value>
                </s:Subcode>
             </s:Code>
             <s:Reason>
                <s:Text xml:lang="en-IN">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.</s:Text>
             </s:Reason>
          </s:Fault>
       </s:Body>
    </s:Envelope>

    Please advice how i should proceed. Any help is appreciated.


    Monday, August 5, 2013 6:46 AM

Answers

  • Hi,

    Please try to refer to the following steps to allow soapUI to consume a WCF service which is using wsHttpBinding:

    1. By default Message Security is turned on for wsHttpBinding, which isn't supported by soapUI. So the security mode for the binding needs to be set to None:

          <bindings>
            <wsHttpBinding>
              <binding>
                <security mode="None">
                </security>
              </binding>
            </wsHttpBinding>
          </bindings>

    2. After creating the new soapUI project, the only update that is required is to select the 'Add default wsa:To' check box (as WS-Addressing is part of the wsHttpBinding). Enable/Disable WS-A addressing should already be selected, along with the appropriate SOAP action. The below options are available when you click the WS-A button, available as part of the Request window.

    Best Regards.


    Amy Peng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Tuesday, August 6, 2013 7:25 AM
    Moderator

All replies

  • Hello Balaji,

    Take a look at this post: http://nzpcmad.blogspot.co.nz/2012/02/wcf-soapui-error.html


    Jeff

    Monday, August 5, 2013 9:12 PM
  • Hi,

    Please try to refer to the following steps to allow soapUI to consume a WCF service which is using wsHttpBinding:

    1. By default Message Security is turned on for wsHttpBinding, which isn't supported by soapUI. So the security mode for the binding needs to be set to None:

          <bindings>
            <wsHttpBinding>
              <binding>
                <security mode="None">
                </security>
              </binding>
            </wsHttpBinding>
          </bindings>

    2. After creating the new soapUI project, the only update that is required is to select the 'Add default wsa:To' check box (as WS-Addressing is part of the wsHttpBinding). Enable/Disable WS-A addressing should already be selected, along with the appropriate SOAP action. The below options are available when you click the WS-A button, available as part of the Request window.

    Best Regards.


    Amy Peng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Tuesday, August 6, 2013 7:25 AM
    Moderator