Search code examples
karatewshttpbinding

WSHttpBinding issue with Karate Framework


We have web services developed using .NET and some of the services use basicHttpBinding and some use wsHttpBinding.

By using Karate framework ,the services which use basicHttpBinding are getting executed fine but not wsHttpBinding.Getting response code 415.

The same services which use wsHttpBinding are getting executed fine in another tool like SoapUI by doing the following at the SoapUI end.

  • check Enable WS-A addressing
  • check Add default wsa:Action
  • check Add default wsa:To

The content type for basicHttpbinding services is 'text/xml' but for wsHttpbinding services is 'application/soap+xml'.

Is there any solution to make it work using Karate framework.


Solution

  • Yes, there is an easy solution, don't use the * soap action 'foo' syntax and just use * method post. Then you have the complete flexibility to shape the request exactly the way you want it.

    Especially if you have Postman or SoapUI working, just look at the request log and it should take you five minutes to create a Karate equivalent. Hope that helps !

    Think of * soap action 'foo' as just a convenience that does 2 extra things:

    • set the Content-Type to application/xml
    • set the HTTP method as POST

    Everything else is 'normal' Karate, in this case you just need to ensure the XML payload contains the extra wsa:Action and wsa:To elements.