Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAX-WS Consuming Exchange Web Services with java using glassfish, error authentication: Unauthorized

 
Eric Koni
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to consume exchange web services with java using glassfish. The client is written using Netbeans 6.7.1 and I’m receiving the following error:

JAX-WS RI 2.1.3.1-hudson-749-SNAPSHOT: Stub for https://scooby-doo.org/EWS/Exchange.asmx
Exception in thread "main" com.sun.xml.ws.client.ClientTransportException: request requires HTTP authentication: Unauthorized

I tried putting the username and password in the SOAP message using:

String uid = domain + "\\" + username;

ExchangeServicePortType port = exchangeWebService.getExchangeWebPort();

((BindingProvider)port).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, uid);
((BindingProvider)port).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, password);

But it still fails with the ‘noted above’ error message.

Then I tried using an “Authenticator”. From understanding I do not have to associate it with web service, since the same object is used for the whole JVM, correct?

MyAuthenticator auth = new MyAuthenticator(username, uid);
Authenticator.setDefault(auth);

But again, it still fails with the same ‘noted above’ message.

Additionally, I’m able to access the web service via the browser i.e.,

https://scooby-doo.org/EWS/Exchange.asmx

So I know my credentials are good. I’m really stumped javascript:emoticon(''); any “HELP” would be greatly appreciated.

Thanks,
 
Jeremy Bunag
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working on EWS too (just starting), and I found this elsewhere. The authenticator requires basic authentication:

from Yale Exchange and Java article


Hope this helps!

-Jeremy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic