Is there a possibility of using REST Assured library for testing SOAP webservices? I have a bunch of Test Suites in SOAP UI and I need to check if there is possibility of using REST Assured. Can anyone suggest if this is possible? Many thanks for any comments.


3 Answers 3


Yes it is possible. I have written this code and it is working form me:

Created a file SoapRequestFile.xml with the content:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">

Then here is code I have written in eclipse:

public void postMethod() throws Exception {
        FileInputStream fileInputStream = new FileInputStream(new File(".\\SOAPRequest\\SoapRequestFile.xml"));
         Response response=given()
                .header("Content-Type", "text/xml")
        XmlPath jsXpath= new XmlPath(response.asString());//Converting string into xml path to assert
        String rate=jsXpath.getString("GetConversionRateResult");
        System.out.println("rate returned is: " +  rate);

Yes, it is possible, however not necessarily easy.

SOAP Web service is (usually) receiving HTTP requests with XML in the body and sending back HTTP responses with XML in the body.

REST-assured can send HTTP requests with any content, including XML. It can also verify XML in responses with GPath.

Here's an example from REST-assured site:

Imagine that a POST request to http://localhost:8080/greetXML returns:


i.e. it sends back a greeting based on the firstName and lastName parameter sent in the request. You can easily perform and verify e.g. the firstName with REST assured:

         parameters("firstName", "John", "lastName", "Doe").
         body("greeting.firstName", equalTo("John")).

The problem is that SOAP Requests and SOAP Responses are usually far more complex and you will need to understand WSDL descriptors yourself.


REST-assured does not have direct support for testing SOAP services, but it is possible by manually setting the SOAPAction and Content-Type headers and doing an HTTP POST etc. Then you can run XPath assertions on the response like you do for normal REST services in REST-assured.

I suggest you also evaluate Karate as it has built-in support for SOAP, and also makes XML manipulation a lot easier.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.