Print request in the report

I was trying to log the request and response details the .html report.
RequestObject request = new RequestObject(findTestObject(‘User/Get User by id’).getObjectId())

response = WS.sendRequest(request)
KeywordUtil.logInfo(request.getHttpBody())

But getting below error :

2022-06-10 16:50:46.788 ERROR c.k.k.core.keyword.internal.KeywordMain - :x: Unable to send request (Root cause: java.lang.IllegalArgumentException: URI is not absolute
at com.kms.katalon.core.webservice.common.HttpUtil.sendRequest(HttpUtil.java:114)
at com.kms.katalon.core.webservice.common.BasicRequestor.send(BasicRequestor.java:58)
at com.kms.katalon.core.webservice.helper.WebServiceCommonHelper.sendRequest(WebServiceCommonHelper.java:28)
at com.kms.katalon.core.webservice.keyword.builtin.SendRequestKeyword$_sendRequest_closure1.doCall(SendRequestKeyword.groovy:40)
at com.kms.katalon.core.webservice.keyword.builtin.SendRequestKeyword$_sendRequest_closure1.call(SendRequestKeyword.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:74)
at com.kms.katalon.core.webservice.keyword.builtin.SendRequestKeyword.sendRequest(SendRequestKeyword.groovy:38)
at com.kms.katalon.core.webservice.keyword.builtin.SendRequestKeyword.execute(SendRequestKeyword.groovy:33)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:74)
at com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords.sendRequest(WSBuiltInKeywords.groovy:40)
at com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords$sendRequest.call(Unknown Source)
at GetUserTest.run(GetUserTest:37)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:445)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:436)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:415)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:407)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:284)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:142)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:133)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1654860041778.run(TempTestCase1654860041778.groovy:25)
)

1 Like

Hi @shubham.butoliya, welcome to our Katalon Community!

Please see my suggestions below:

java.lang. IllegalArgumentException: URI is not absolute occurs when a relative url is used to identify the resource. In the spring boot RestTemplate, the complete url will be used to invoke the rest call. If the relative url is used in the restful call, the java exception java.lang. IllegalArgumentException: URI is not absolute would be thrown.

Reference:
https://www.yawintutor.com/uri-is-not-absolute/


Hope this helps. Have a great week!