Client code. If SSL
webservice = your_webservice_stub;
BindingProvider bp = (BindingProvider) your_webservice;
Map<String, Object> context = bp.getRequestContext();
// if you need to change the endpoint
// context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);
// System.out.println("new endpoint: " + endpoint);
// if the endpoint is https
// System.setProperty("javax.net.ssl.trustStore", [path to your truststore]
// System.out.println("add basic auth credentials");
context.put(BindingProvider.USERNAME_PROPERTY, "[your_username]");
context.put(BindingProvider.PASSWORD_PROPERTY, "[your_password]");