-
1. Re: accessing secure wsdl
zurchman Jul 1, 2010 5:36 PM (in response to gryffin)Client code.
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]"); -
2. Re: accessing secure wsdl
gryffin Jul 1, 2010 5:55 PM (in response to zurchman)Thank you. Unfortunately, I do this already as you can see here:
assetApiService = new AssetAPIService( );
assetService = assetApiService.getAssetAPIServiceHttpPort();
((BindingProvider)assetService).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "******");
((BindingProvider)assetService).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "******");The problem arises because assetApiService = new AssetAPIService( ); fails. It fails because the entire service url is protected. I need to provide the username/password at the time the WSDL is dynamically sought as the ws stub is instantiated.
So I somehow need to get the credentials into a the context somewhere around here:
public AssetAPIService(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}where 'wsdlLocation' is password protected. Thanks!