Error when using a global variable in REST web request

Hi,

After reading this page:

https://docs.katalon.com/katalon-studio/docs/parameterize-a-web-service-object.html#query-parameters

I decided to create a global variable in the default profile: base_url, to be used in the Object repository, in the web service request as follows:

https://${GlobalVariable.base_url}/restOfUrl

It keeps giving me errors: Root cause: java.net.UnknownHostException: ${GlobalVariable.base_url}

If I call the variable from a test (only GlobalVariable.base_url), it works perfectly.

Could anybody tell me where did I go wrong?

Any help is welcome.

1 Like

We only support parameterizing directly in the URL with GlobalVariable since version 6.3.0. You can download the beta version at https://github.com/katalon-studio/katalon-studio/releases

Thanks huynguyen,

I have just downloaded the rc8 and it is just impossible to activate it. It keeps telling me that the user or password is invalid, but I am connected here with the same user and password, and I have another version installed in my computer with the same user and password.

Any help is welcome.

Hi @spr2019, Have you changed your password recently?

No, I didn’t. And the last Katalon version I installed was recent, around 3 weeks ago.

Hi,

I have a workaround for the activation issue, I just chose the option “activation offline” and worked like a charm.
I have re-executed the test, as it works in 6.2.1 (Web request, no global variable) and doesn’t work.
I have introduced a global variable, and yes, it takes the global variable, but still throws that error that I don’t have in version 6.2.1:

com.fasterxml.jackson.core.JsonParseException: Unexpected character (’’ (code 92)): was expecting double-quote to start field name at [Source: io.undertow.servlet.spec.ServletInputStreamImpl@609a45ca; line: 1, column: 3]

Hi @spr2019,
Can you send me your request object file?

Hi Huynguyen,

This is my rs object:

<?xml version="1.0" encoding="UTF-8"?> login - community d8476d7f-00d3-4091-8b7e-b76af304cbeb BASIC false false { "text": "{\"login\": \"myuser\", \"password\": \"mypassword\"}", "contentType": "application/json", "charset": "UTF-8" } text true equals Content-Type Main application/json true equals Authorization Main Bearer 5.4.1 POST https://myurl/auth/api/v1.0/login RESTful import static org.assertj.core.api.Assertions.*

import com.kms.katalon.core.testobject.RequestObject
import com.kms.katalon.core.testobject.ResponseObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webservice.verification.WSResponseManager

import groovy.json.JsonSlurper
import internal.GlobalVariable as GlobalVariable

RequestObject request = WSResponseManager.getInstance().getCurrentRequest()

ResponseObject response = WSResponseManager.getInstance().getCurrentResponse()


Thanks for your support.

Hi @spr2019,
Please send the .rs file

Hi, that is the rs file content.

login - community.zip (941 Bytes)

Hi @spr2019,
I have tried sending a request with your request object file and encounter no problem. You can download Katalon Studio 7.0.0 beta release at https://github.com/katalon-studio/katalon-studio/releases and try again.
Regards.