bik
7 years agoOccasional Contributor
extracting location header from raw response and using that as a endpoint for next step in a request
The response is of a post
HTTP/1.1 201 Created
Date: Fri, 15 Jun 2018 08:01:27 GMT
Server: Apache
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-XSS-Protection: 1; mode=block
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Set-Cookie: JSESSIONID=2YCtIlPMfCYNO3mQ3V2AlGqu.hfs-support-service_test_0; Path=/hfs-support-service
X-Application-Context: application
Location: http://xx/abcde
Keep-Alive: timeout=6, max=69
Connection: Keep-Alive
the groovy script is used to extract the location which is working fine
def vals = testRunner.testCase.getTestStepByName("TC_POST_EXTUSER").httpRequest.response.responseHeaders["Location"]
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
groovyUtils.setPropertyValue("Request2", "Endpoint", vals.toString())
but while trying to use the extracted location header value in next request with a null pointer exception.
I would like the endpoint of next request to be populated with the value.