WS.sendRequest is not fetching any response

WS.sendRequest is not fetching any response data where as when API request is run in Object Repository is fetching response data

def response = WS.sendRequest(findTestObject(‘#request’))


Do you receive any error log or have you imported enough lib? What is #request


There is no error message and the request is successful, required libraries are also imported which is working fine for similar kind of API
Screenshot of Send Request fetching no data:

Screenshot of same API request fetching data:

You have several methods underlined, such as sendRequest and getResponseText. To me, that indicates you do not have the import statement for them. Can you hit CTRL + SHIFT + O (oh) to autofill your import statements and see if that helps?

Hi, tried but no luck, request is running fine , the issue is the data is not fetched from the response.

Please show the Header part of the HTTP Response.

Especially I think you should check Content-Type header value. Character encoding will matter.

I know Katalon’s ResponseObject class several bugs in dealing with Content-Type. If the Content-Type has a value which Katalon does not expect, getResponseText() may return something strange.

You can read the source of ResponseObject class:

Please read it to find out how your HTTP Response will be processed. You should be able to find out why getResponseText() returned something you didn’t expect.

Well, let’s dig on this.
The way I usually do is, write a simple tescase calling your test object.
I am using `send and verify’ in this example but same should work properly with just a simple send.

Once I run this, i see in the log viewer it went good.
Now i switch to the console tab:

Alongside of the tescases info execution, I have a hint of the captured response, built in by katalon by using mobproxy

So, I click on that and I inspect the actual request and response I sent, without fuzzing with various debug techniques or code voodoo.
Like this:

so you have to look carefully there and see:

  • did you sent a valid request?
  • did you get a propper response?

After that you can dig more on how filter the data needed from the entire response.
E.g you can upload here the har file you got, if there is no sensitive data in it, so we can take a closer look.


I have tried to debug with the above steps, I’m able to see the response data in the .har file but the data is not fectched from the request as I have added in the above screenshots

The issue is not with getResponseText(),

Below is the request.
def response = WS.sendRequest(findTestObject(‘Object Repository/VesselDepotInventory’))
the request is successful but when I’m trying to print the response it is giving null
and when I run the API request from object repository, I’m able to see the data in the response.

I am not sure if this method works properly, particularily with json responses.
Try to use getResponseBodyContent() instead.

I hope this is just a typo.
You should retrieve the data from the reponse object.

I have tried with getResponseBodyContent() also, same result.
Note: Earlier the scripts were working fine, only from last week I’m getting this issue.

well … than, you should do some research on what happened since the last week.
you updated your code?
you updated katalon?
the developper updated the API you are testing?
… and so on.