Preciso consumir um Webservice através do Apache CXF e estou tendo problemas na autenticação do proxy.
Criei uma classe simples e estou recebendo a mensagem de proxy authentication required.
org.apache.cxf.transport.http.HTTPException: HTTP response '407: Proxy Authentication Required'
Segue meu código de teste:
private static String domain = "DOMINIO";
private static String userName = "usuario";
private static String password = "senha";
public static void main(String args[]) throws Exception {
Authenticator.setDefault(new Authenticator() {
@Override
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(domain + "\\" + userName, password.toCharArray());
}
});
System.setProperty("proxySet", "true" );
System.setProperty("http.proxyHost", "172.17.3.22");
System.setProperty("http.proxyPort", "3128");
System.setProperty("http.proxyUser", domain + "\\" + userName);
System.setProperty("http.proxyPassword ", password);
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.setServiceClass(XXXServiceSoap.class);
factory.setAddress("http:/xxx.com.br/XXX/XXX.asmx");
XXXServiceSoap client = (XXXServiceSoap) factory.create();
LeitorObjWS[] dados = client.obterRespostas(new GregorianCalendar());
System.out.println("Resposta 1: " + dados[0]);
System.exit(0);
}
Alguém tem alguma dica para fazer a autenticação do proxy de outra forma ?
PS: Houveram alterações recentes no proxy no modo de autenticação. O proxy é squid mas é integrado ao AD.
Obrigado