java - Apache Client 4.3.4 with proxy NTLM Auth -
i have post data , have use proxy ntlm auth. problem is, 407 (proxy auth required) proxy. have no control of proxy, can not debug here!
the client logs shows proxy states:
1.) proxy auth state: unchallenged
2.) proxy auth state: challenged
3.) proxy auth state: handshake
perhaps can check code, if should work, because hope proxy settings wrong.
ntcredentials ntcreds = new ntcredentials(ntusername, ntpassword,localmachinename, domainname ); credentialsprovider credsprovider = new basiccredentialsprovider(); httphost httpproxy = new httphost(inetaddress.getbyname(proxystring), integer.valueof(proxyport)); credsprovider.setcredentials( new authscope(httpproxy), ntcreds ); httpclientbuilder clientbuilder = httpclientbuilder.create(); clientbuilder.setproxy(httpproxy); clientbuilder.setdefaultcredentialsprovider(credsprovider); clientbuilder.setproxyauthenticationstrategy(new proxyauthenticationstrategy()); closeablehttpclient client = clientbuilder.build(); uri destination = new uri("http://requestb.in/1bpjk7g"); httpentity entity = new stringentity("test 123"); httppost request = new httppost(destination); requestconfig config = requestconfig.custom().setproxy(httpproxy).build(); request.setconfig(config ); request.setentity(entity); client.execute(request);
Comments
Post a Comment