0
它总是捕捉异常,并输出到检索XML文件时“无法读取数据$ DID:$别名”当我运行阅读():HttpResponseException尝试使用Groovy脚本
http = new HTTPBuilder('https://somewebsite.com')
def read(http, path, dId, alias, portalFile, outputFileName) {
try {
println "Reading : path:$path, file:$portalFile"
http.get(path: path,
contentType: TEXT,
query: [id:dId, instance:alias, format:'xml', file:portalFile]) {resp, reader ->
println "response status: ${resp.statusLine}"
println 'Headers: -----------'
resp.headers.each { h ->
println " ${h.name} : ${h.value}"
}
new File(outputFileName).withWriter{out -> out << reader}
}
} catch (HttpResponseException h) {
println "Unable to read data for $dId:$alias"
}
}
如果我去该网站使用我的互联网浏览器,并点击我需要的XML文件,它的工作原理。有什么方法可以输出它连接的URL吗?