try
{
this.serviceClient = new ServiceClient();
this.serviceClass = serviceClass;
this.wsdlUrl = wsdlUrl;
final WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
if (username != null && username.trim().length() > 0)
{
final Authenticator authenticator = new Authenticator();
final List<String> authorizationSchemes = new ArrayList<String>();
authorizationSchemes.add(Authenticator.BASIC);
authenticator.setAuthSchemes(authorizationSchemes);
authenticator.setUsername(username);
authenticator.setPassword(password);
authenticator.setPreemptiveAuthentication(true);
this.serviceClient.getOptions().setProperty(
HTTPConstants.AUTHENTICATE,
authenticator);
synchronized (this.definitionMonitor)
{
this.definition =
this.readProtectedWsdl(
reader,
wsdlUrl,
username,
password);
}
}
else
{
synchronized (this.definitionMonitor)
{
this.definition = reader.readWSDL(wsdlUrl);
}
}
String portAddress;
if (endpointAddress != null && endpointAddress.trim().length() > 0)
{