Forum Discussion

vihang's avatar
vihang
Occasional Contributor
9 years ago

http/1.1.407 proxyauthentication required in groovy script

I am trying to trigger the request using HTTPBuilder in groovy script: Here's my script.Here I already defined groovyUtils just not mentioned in code:

I am trying to trigger the request using HTTPBuilder in groovy script: Here's my script.Here I already defined groovyUtils just not mentioned in code:

String url="http://oba.com"
String uriPath="/contact"
def req=groovyUtils.getXmlHolder("myReq#request")

HTTPBuilder http=new HTTPBuilder(url)
http.client.getCredentials(
new AuthScope('myProxy',port)
new UserNamePasswordCredentials('userName','Password')
)
http.setProxy('myProxy',port,'http')

http.request(Method.POST,ContentType.XML){
uri.Path=uriPath
headers.'user-id'='nbxxx'
body:req

response.success{resp1,reader->
log.info "$resp1.statusLine"

}
response.failure{resp1->
log.info "status:$resp1.statusLine"
}
}

but in it is printing that in failure that "http/1.1.407 proxyAuthentication required" why I am getting this. I already mention proxy here 

No RepliesBe the first to reply