aspose file tools*
The moose likes Web Services and the fly likes JAX-WS Consuming Exchange Web Services with java using glassfish, error authentication: Unauthorized Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAX-WS Consuming Exchange Web Services with java using glassfish, error authentication: Unauthorized" Watch "JAX-WS Consuming Exchange Web Services with java using glassfish, error authentication: Unauthorized" New topic
Author

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

Eric Koni
Greenhorn

Joined: Oct 09, 2009
Posts: 3
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

Joined: Nov 19, 2009
Posts: 1
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
 
jQuery in Action, 2nd edition
 
subject: JAX-WS Consuming Exchange Web Services with java using glassfish, error authentication: Unauthorized