Hi! Could anyone explain to me usage of the WS Builder with different request methods. I am trying this:
'Create a new POST object using builder'def builder = new RestRequestObjectBuilder()def reqOrders = builder .withRestRequestMethod('POST') .withRestUrl('URL') .withHttpHeaders([ new TestObjectProperty('Authorization', ConditionType.EQUALS, parsedUserToken), new TestObjectProperty('Content-Type', ConditionType.EQUALS, 'application/json') ]) .withRestParameters([ new TestObjectProperty('service', ConditionType.EQUALS, 'value'), new TestObjectProperty('userId', ConditionType.EQUALS, 'value'),
new TestObjectProperty('currency', ConditionType.EQUALS, 'value'),
new TestObjectProperty('price', ConditionType.EQUALS, 'value'),
new TestObjectProperty('amount', ConditionType.EQUALS, 'value'),
new TestObjectProperty('coins', ConditionType.EQUALS, 'value'),
new TestObjectProperty('lang', ConditionType.EQUALS, 'EN'), new TestObjectProperty('returnPage', ConditionType.EQUALS, 'value') ]) .build()'Send a request'def respOrders = WSBuiltInKeywords.sendRequest(reqOrders)
As a result Iâve receive this failure:
FAILED because (of) Unable to send request (Root cause: java.lang.NullPointerException)
In the examples from this link: https://docs.katalon.com/display/KD/Web+Services+Builder builder of âGETâ method using â.withRestParametersâ and ânew TestObjectPropertyâ, builder of âPOSTâ method using â.withUrlEncodedBodyContentâ and ânew UrlEncodedBodyParameterâ - maybe that is my problem?
Thanks!