Skip to content

Instantly share code, notes, and snippets.

@edubriguenti
Last active December 25, 2015 19:39
Show Gist options
  • Save edubriguenti/7029225 to your computer and use it in GitHub Desktop.
Save edubriguenti/7029225 to your computer and use it in GitHub Desktop.
Basic Authentication WebService
try {
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(
Properties.obterPropertiesEndPoint().readString(Constantes.ENDPOINT_PESSOAS_USERNAME),
descriptografarSenha(Properties.obterPropertiesEndPoint().readString(Constantes.ENDPOINT_PESSOAS_PASSWORD)).toCharArray());
}
});
soap11 = new ContratoIntegrationServiceSoap11 (new URL(Properties.obterPropertiesEndPoint().readString(Constantes.ENDPOINT_CONTRATOS)),
new QName(QNAME_1, QNAME_2)
);
proxy = soap11.getContratoIntegrationServiceSoap11SOAP();
((BindingProvider)proxy).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, Properties.obterPropertiesEndPoint().readString(Constantes.ENDPOINT_PESSOAS_USERNAME));
((BindingProvider)proxy).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, descriptografarSenha(Properties.obterPropertiesEndPoint().readString(Constantes.ENDPOINT_PESSOAS_PASSWORD)));
((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,Properties.obterPropertiesEndPoint().readString(Constantes.ENDPOINT_PESSOAS));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment