• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

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

Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 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);

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.,


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

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!

You'll never get away with this you overconfident blob! The most you will ever get is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic