I'm fairly new to Groovy & SoapUING. I hope someone can help me figure out and fix this error. Thanks!
What I'm trying to do: Iterate through each db row item in a table and use that as input to make a HTTPBuilder
request (GET or POST) either as a query in path (add baseURL/path/hello
) or through parameters(add baseURL/path?searchNode="hello"
). The baseURL is something like this https://search-test-env.ser.com
.
Where I'm getting stuck: When I try to post a request through HTTPBuilder
.
Error: PKIX Path Building Failed
Other related information:
- Using ReadyAPI to run the scripts. Code is in Groovy.
- Recently imported the httpbuilder jar into ReadyAPI/lib folder along with some dependencies. Of the dependencies available with httpbuilder, ReadyAPI already had few so I only picked up the ones missing. Additional jar names:
ojdbc6, ojdbc6_g, signpost-commonshttp4-1.2.1.1, ezmorph-1.0.6, json-lib-2.3-jdk15, xml-resolver-1.2, signpost-core-1.2.1.1, appengine-api-1.0-sdk-1.3.8, nekohtml-1.9.16, http-builder-0.7, http-builder-0.7-sources, http-builder-0.7-javadoc
. - The Service works with a manual request without groovy (simple GET on the baseURL/path) and it also works with query by string or by parameter.
- The certificate is already available in the Keystore. Tried using keytool (available in ReadyAPI/bin folder) command through cmd but receiving a filenotfound error). Tried to import into the ReadyAPI\jre\lib\security.
Code:
def qryPrmRqstHTTPBldr( pBaseUrl, pPath, pQuery, pMethod ) {
def ret = null
def http = new HTTPBuilder()
def meth
if ( pMethod == 'GET') {
meth = Method.GET
}
else if ( pMethod == 'POST') {
meth = Method.POST
}
// perform a GET/POST request, expecting TEXT response
http.request(pBaseUrl, meth, ContentType.TEXT) { req ->
uri.path = pPath
uri.query = pQuery
/*
headers.'User-Agent' = 'Apache-HttpClient/4.5.1 (Java/1.8.0_66)'
headers.'Host' = 'xxx-xx-xxx.xxx.xxx'
headers.'Accept-Encoding' = 'gzip,deflate'
headers.'Connection' = 'Keep-Alive'
*/
log.info System.getProperty("java.runtime.version")
log.info System.getProperty("javax.net.ssl.trustStore")
log.info System.getProperty("javax.net.ssl.keyStore")
log.info System.getProperty("java.home")
log.info System.getProperty("java.class.path")
// response handler for a success response code
response.success = { resp, reader ->
println "response status: ${resp.statusLine}"
println 'Headers: -----------'
ret = reader.getText()
println 'Response data: -----'
println ret
println '--------------------'
}
}
return ret
}
Running this code throws the PKIX Path Building Failed
error (no stack trace available) and the content for each property:
System.getProperty("java.runtime.version") // 1.8.0_66-b17
System.getProperty("javax.net.ssl.trustStore") // null
System.getProperty("javax.net.ssl.keyStore") // null
System.getProperty("java.home") // c:\program files\smartbear\readyapi-1.6.0\jre
System.getProperty("java.class.path") // C:\Program Files\SmartBear\ReadyAPI-1.6.0\.install4j\i4jruntime.jar;......