I have a web application, written in Java, that makes a JAX-WS web service call to an exchange server using Exchange Web Services.
When I compile and run the application using Java 1.6.0_34, it works fine.
If I compile and run it with Java 1.7.0_07, I get the following error:
com.sun.xml.ws.client.ClientTransportException: request requires HTTP authentication: Unauthorized
at com.sun.xml.ws.transport.http.client.HttpClientTransport.checkResponseCode(HttpClientTransport.java:212)
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:149)
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:86)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
at com.sun.xml.ws.client.Stub.process(Stub.java:248)
at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:135)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)
at $Proxy62.getUserAvailability(Unknown Source)
...
This also occurs if I compile it with 1.6.0_34 and run it with 1.7.0_07.
I looked for changes to JAX-WS between Java 6 and 7, but I only found some notes about possible compile errors.
I'm not sure what to look at next, as obviously the authentication code hasn't been changed, so why is it failing?
Here's the method that I think should be setting up the authentication:
/**
* Set up Authentication
*
*/
protected void setupAuthenticator(){
if(authenticator == null){
authenticator = new Authenticator(){
protected PasswordAuthentication getPasswordAuthentication(){
String superusername = ExchangeServerPortFactory.this.adDomain
+ "\\"
+ ExchangeServerPortFactory.this.username;
String superPassword = ExchangeServerPortFactory.this.password;
return new PasswordAuthentication(superusername
,superPassword.toCharArray());
}
};
Authenticator.setDefault(authenticator);
}
}
I tried changing "\\"
to "\\\\"
because I found a message on a forum somewhere where this solved a similar problem, but it didn't do me any good.