Simplest SOAP Test doen't work in KS v8.0.x, Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized due to "accessExternalDTD

macOS 11.4 Big Sur

Katalon Studio Version


Katalon Studio logs (2.0 KB)

What I found

This seems to be an known issue to Katalon Team. I report it here again just to share information to those who newly encounter the problem.

I created a simplest SOAP API test project. A ZIP of the project is attached: (104.5 KB)

I executed the Test Case “CalculatorTest”

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testobject.ResponseObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS

ResponseObject response = WS.sendRequest(findTestObject('Calculator'), FailureHandling.CONTINUE_ON_FAILURE)

WS.verifyResponseStatusCode(response, 200)

String xmlString = response.getResponseBodyContent()

I got an Exception Stack trace:

2021-06-16 11:03:25.964 INFO  c.k.katalon.core.main.TestCaseExecutor   - --------------------
2021-06-16 11:03:25.968 INFO  c.k.katalon.core.main.TestCaseExecutor   - START Test Cases/CalculatorTest
2021-06-16 11:03:27.137 DEBUG testcase.CalculatorTest                  - 1: response = sendRequest(findTestObject("Calculator"), CONTINUE_ON_FAILURE)
log4j:WARN No appenders could be found for logger (org.apache.http.client.protocol.RequestAddCookies).
log4j:WARN Please initialize the log4j system properly.
2021-06-16 11:03:28.616 INFO  c.k.k.core.webservice.common.HarLogger   - HAR: /var/folders/7m/lm7d6nx51kj0kbtnsskz6r3m0000gn/T/Katalon/Test Cases/CalculatorTest/20210616_110322/requests/main/0.har
2021-06-16 11:03:28.760 DEBUG testcase.CalculatorTest                  - 2: verifyResponseStatusCode(response, 200)
2021-06-16 11:03:28.789 DEBUG testcase.CalculatorTest                  - 3: xmlString = response.getResponseBodyContent()
2021-06-16 11:03:28.835 ERROR c.k.katalon.core.main.TestCaseExecutor   - ❌ Test Cases/CalculatorTest FAILED.
java.lang.IllegalArgumentException: Property 'http://javax.xml.XMLConstants/property/accessExternalDTD' is not recognized.
	at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.setAttribute(Unknown Source)
	at com.kms.katalon.util.DocumentBuilderProvider.newBuilderInstance(
	at com.kms.katalon.core.testobject.ResponseObject.getResponseBodyContent(
	at com.kms.katalon.core.testobject.ResponseObject$ Source)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(
	at com.kms.katalon.core.main.TestCaseExecutor.execute(
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$ Source)

2021-06-16 11:03:28.850 INFO  c.k.katalon.core.main.TestCaseExecutor   - END Test Cases/CalculatorTest

Here is the screenshot of Katalon Studio GUI when I got that error:

In the statck trace I found this line:

at com.kms.katalon.util.DocumentBuilderProvider.newBuilderInstance(

This message shows the exact location where the Exception was raised. I clicked the underlined Then Katalon Studio showed the source code of the class.

/*    */ public class DocumentBuilderProvider {
	/*    */ public static DocumentBuilder newBuilderInstance() throws ParserConfigurationException {
		/* 15 */ DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
		/* 16 */ dbFactory.setAttribute("http://javax.xml.XMLConstants/property/accessExternalDTD", "");
		/* 17 */ dbFactory.setAttribute("http://javax.xml.XMLConstants/property/accessExternalSchema", "");
		/* 18 */ return dbFactory.newDocumentBuilder();
		/*    */ }
	/*    */ }

This decompiled source code tells us that the com.kms.katalon.util.DocumentBuilderProvider class of KS v8.0.1 calls

/* 16 */ dbFactory.setAttribute("http://javax.xml.XMLConstants/property/accessExternalDTD", "");

This very statement is causing the `IllegalArgumentException: Property '“http://javax.xml.XMLConstants/property/accessExternalDTD” is not recognized.

In v 7.9.1

I tried the same in Katalon Studio v7.9.1. No exception was raised.

What I guess

The problematic statement:

/* 16 */ dbFactory.setAttribute("http://javax.xml.XMLConstants/property/accessExternalDTD", "");

I guess, this statement has been newly inserted in the KS v8.0.x. For what? I don’t know.
I guess, this statement was not there in the KS 7.9.0.
This is the reason why we see this exception only since KS v8.0.x.

Additional info

The sample project has a Test Case named “printXercesJarLocation”.

import org.apache.xerces.jaxp.DocumentBuilderFactoryImpl

URL u = DocumentBuilderFactoryImpl.class.getResource("/" + DocumentBuilderFactoryImpl.class.getName().replaceAll("\\.", "/") + ".class");


When I ran it i got the following output.


This proves that Katalon Studio 8.0.1 bundles the org.apache.xerces.impl_2.11.0.jar; which was released Feb, 2013.

According to this post on Stackoverflow,

Apache Xerces-J 2.12.0 and earlier implement older versions of JAXP that do not support either of the properties that you are trying to set.

My conclusion

So, I guess Katalon Team has made a mistake at v8.0.1, at com.kms.katalon.util.DocumentBuilderProvider class. Due to it, Katalon Studio v8.0.x can not process SOAP request/response messages and other XML documents appropriately.

But, if user’s Test Case and Keywords process XML documents without calling the problematic com.kms.katalon.util.DocumentBuilderProvider class, it will work fine.

-> @ThanhTo, @duyluong

Using v7.9.1, I checked if this class is available or not. See the following screenshot.

This check proved that the com.kms.katalon.util.DocumentBuilderProvider was newly introduced as of v8.0.x. This is the reason why we see the IllegalArgumentException in the v8.0.1 and do not see it in the v7.9.1.