Not able to validate SOAP call response


I hope Katalon Team to spare time to improve the official document of WS.verifyElementText

I tried 8.2.0beta. I confirmed that WS.verifyElementText() works for a SOAP response with Header element.

I would remind you of an outstanding issue.

Provided that the response SOAP XML is like this:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsi="" xmlns:env="">
    <ns:PreAuthorizeResponse xmlns:ns="beep" xmlns:ns2="bop" xmlns:ns1="foo" >

I tried the following test:


This failed as follows:

2021-10-08 18:36:01.105 ERROR c.k.k.core.keyword.internal.KeywordMain  - āŒ Expected text is 'Approved' but actual element text is: Approved
2021-10-08 18:36:01.122 ERROR c.k.k.core.keyword.internal.KeywordMain  - āŒ Unable to verify element text (Root cause: com.kms.katalon.core.exception.StepFailedException: Expected text is 'Approved' but actual element text is: Approved
	at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:50)

I amended the test script as follows:


Please note that the 3rd argument


contains a NEWLINE character plus 8 whitespaces.

The amended test script passed.

This example shows that the WS.verifyElementText() keyword is difficult to use. It checks if the XML element content text is strictly equal to the 3rd argument string. Any NEWLINEs and whitespace characters easily break the equality test. Unfortunately the keyword offers no way to make the verification tolerant of whitespaces.

The official documentation explains nothing about the strictness for whitespaces. I am afraid that many people would get stuck with it.

Therefore I would still argue, users should not rely on this keyword. They should rather parse the XML in the Web Service Response themselves to look up elements of their interest while trimming (or ignoring) whitespaces in the content text as appropriate.

1 Like

Yes, sure @kazurayam.
Thanks for your suggestion.

Nam Nguyen.

I would like to suggest a code change:

Current Line#50

            boolean isEqual = (text.equals(String.valueOf(retValue)))

I would propose to change this to:

            boolean found = String.valueOf(retValue).contains(text.trim())

This change would not break existing scripts of users.

And the keyword WebUI.verifyElementText() will become tolerant for whitespaces in the response body.

The current official document writes:


  • true , if your element text is found, otherwise; false .

This description is ambiguous enough. The aforementioned change would not break the doc. :wink:

1 Like

Hi @kazurayam,

We will verify the solution and apply it if it works perfectly.
Really appreciate your idea!

Nam Nguyen.