I am unable to send API request to on Premises Azure DevOps using Katalon

azure

#1

Hi,
I am unable to send API request to on Premises Azure DevOps using Katalon. I am able to send the same request via Postman after switching off SSL in Postman.

I am not able to find option to switch off SSL in Version: 6.3.2 Build: 4.

See attached Snap for error


#2

Hi @paksmanzoor,
What do you mean by this: “I am able to send the same request via Postman after switching off SSL in Postman.”?


#3

I want to send API requests to my On Premises Azure DevOps. Unfortunately SSL is not configured by System Administration team. I can send API requests to Azure DevOps in this situation via Postman after switching off SSL in POSTMAN. But Katalon is not allowing me and showing error I mentioned via snap in my first post.

I tried all available solutions like bypass Proxy and bypass Certificate etc but nothing works.

Can you please help? I am trying to evaluate Katalon for test automation needs of my organization.


#4

@huynguyen i think the OP is referring to turn off certificate validation (aka send insecure requests). Postman has this feature
similar to curl -k


#5

yes @Ibus you are right. I am not able to find the feature to turn of certificate validation in Katalon. Any solution @huynguyen ?


#6

Hi @paksmanzoor,
The option to turn off certificate validation is “Bypass certificate validation” in Project > Settings > Network. But you said you have tried that option and it didn’t work. Can you take a screenshot of the settings from Postman which you configure to make it work?


#7

Hi @huynguyen please see the snap below for settings in my Katalon Project

Here are the settings of Postman


In postman I can call Azure DevOps’ API with no error after setting off SSL.

But in Katalon I am facing error, see snap below


#8

@huynguyen any update?


#9

Hi @paksmanzoor,
Can you send the request from test case script?


#10

@huynguyen I tried in test case script mode. And it worked.

But not the normal way. I mean as I mentioned early in the thread that when I create request in object repository and send request in manaul test case mode, why it’s not bypassing certificate validation although bypass certificate is checked in project settings?

And why its working in script mode?


#11

Hi @paksmanzoor,
Can you share your test script?
Regards,
Huy Nguyen


#12

@huynguyen, first of all my mistake that I mentioned it is working in script mode. Actually in scripting mode its working for cloud version but not on promises even via script.See details below

SCRIPT

import com.kms.katalon.core.testobject.ConditionType
import com.kms.katalon.core.testobject.RequestObject
import com.kms.katalon.core.testobject.ResponseObject
import com.kms.katalon.core.testobject.RestRequestObjectBuilder
import com.kms.katalon.core.testobject.TestObjectProperty
import com.kms.katalon.core.testobject.impl.HttpTextBodyContent
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS

import com.kms.katalon.core.testobject.ResponseObject
import com.kms.katalon.core.util.KeywordUtil

SampleRequestObject req = new SampleRequestObject()
ResponseObject resp = req.buildApiRequest()
if (SampleResponseObject.getStatusCode(resp) != 200) {
KeywordUtil.markFailed("Status code is not 200 as expected. It is " +
SampleResponseObject.getStatusCode(resp))
}

public class SampleRequestObject
{

//String endpoint = "https://www.katalon.com"
String endpoint = 'https://tfs/[Collection]/[Project]/_apis/wit/workitems/[Workitem ID]?api-version=1.0'
String requestMethod = "GET"
String authHeader = 'Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
 
TestObjectProperty header1 = new TestObjectProperty("Authorization", ConditionType.EQUALS, authHeader)
TestObjectProperty header2 = new TestObjectProperty("Content-Type", ConditionType.EQUALS, "application/x-www-form-urlencoded")
TestObjectProperty header3 = new TestObjectProperty("Accept", ConditionType.EQUALS, "application/json")
ArrayList defaultHeaders = Arrays.asList(header1, header2, header3)
	 
public ResponseObject buildApiRequest() 
{
	RequestObject ro = new RestRequestObjectBuilder()
	.withRestUrl(endpoint)
	.withHttpHeaders(defaultHeaders)
	.withRestRequestMethod(requestMethod)
	.build()
	 
	ResponseObject respObj = WS.sendRequest(ro)
	return respObj
}

}

public class SampleResponseObject
{
public static int getStatusCode(ResponseObject resp)
{
return resp.getStatusCode()

}

}

Log

09-08-2019 11:00:22 AM Test Cases/Create Workitem in On Premisses Azure DevOps

Elapsed time: 1.126s

Test Cases/Create Workitem in On Premisses Azure DevOps FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to send request (Root cause: java.net.SocketException: Connection reset
at com.kms.katalon.core.webservice.common.RestfulClient.response(RestfulClient.java:192)
at com.kms.katalon.core.webservice.common.RestfulClient.sendRequest(RestfulClient.java:97)
at com.kms.katalon.core.webservice.common.RestfulClient.send(RestfulClient.java:59)
at com.kms.katalon.core.webservice.keyword.builtin.SendRequestKeyword$_sendRequest_closure1.doCall(SendRequestKeyword.groovy:42)
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:68)
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:56)
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 SampleRequestObject.buildApiRequest(Script1567660747177.groovy:42)
at SampleRequestObject$buildApiRequest.call(Unknown Source)
at Create Workitem in On Premisses Azure DevOps.run(Create Workitem in On Premisses Azure DevOps:15)
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:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1567926020661.run(TempTestCase1567926020661.groovy:21)
)
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:50)
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:70)
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:56)
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 SampleRequestObject.buildApiRequest(Script1567660747177.groovy:42)
at SampleRequestObject$buildApiRequest.call(Unknown Source)
at Create Workitem in On Premisses Azure DevOps.run(Create Workitem in On Premisses Azure DevOps:15)
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:337)
at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
at TempTestCase1567926020661.run(TempTestCase1567926020661.groovy:21)
Caused by: java.net.SocketException: Connection reset
at com.kms.katalon.core.webservice.common.RestfulClient.response(RestfulClient.java:192)
at com.kms.katalon.core.webservice.common.RestfulClient.sendRequest(RestfulClient.java:97)
at com.kms.katalon.core.webservice.common.RestfulClient.send(RestfulClient.java:59)
at com.kms.katalon.core.webservice.keyword.builtin.SendRequestKeyword$_sendRequest_closure1.doCall(SendRequestKeyword.groovy:42)
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:68)
… 19 more


#13

Hi @paksmanzoor,
Are you behind a proxy?


#14

no I am not behind proxy. I wondering by setting off “SSL Certifcate Verification” in Postman my API request works.But its not working even after setting “Bypass certificate validation”.

I have shared snaps of Katalon settings and Postman and my test script. Please help in this regard. I am gauging tool for implementation in my company and paid support.