Axis version: 1.5.1
Java Version: 1.1.0_13
Authentication: NTLM
Protocol: HTTPS
Platform: Windows XP

Hi
I am trying to access Exchange Web Service running on IIS, using Axis
1.5.1. I generated the stub classes using JAXB data binding. I am
trying to pass the authentication information as follows

###########################################################
stub = new 
com.microsoft.schemas.exchange.services._2006.messages.ExchangeServicesStub();

Options options = stub._getServiceClient().getOptions();

HttpTransportProperties.Authenticator authenticator = new
HttpTransportProperties.Authenticator();

List authScheme = new ArrayList();
authScheme.add("NTLM");
authenticator.setAuthSchemes(authScheme);

authenticator.setUsername("username");
authenticator.setPassword("pasword");
authenticator.setHost("ipaddress");
authenticator.setDomain("domain");
//authenticator.setPreemptiveAuthentication(false);
//authenticator.setRealm(null);
//authenticator.setPort(443);

options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);

//options.setProperty(org.apache.axis2.transport.http.HTTPConstants.REUSE_HTTP_CLIENT,
Boolean.TRUE);

stub._getServiceClient().setOptions(options);
#######################################################

I am stuck up at 401 Unauthorized Error. It says that "Credentials
Provider not available". I have gone through every possible archive
and thread i could find.
My client and server are in same domain but there may be several hops
involved before reaching the Exchange Web Service.
Following is complete log ....



*****************************************************
2009/11/04 17:31:47:239 IST [DEBUG] DefaultHttpParams - Set parameter
http.useragent = Jakarta Commons-HttpClient/3.1
2009/11/04 17:31:47:239 IST [DEBUG] DefaultHttpParams - Set parameter
http.protocol.version = HTTP/1.1
2009/11/04 17:31:47:239 IST [DEBUG] DefaultHttpParams - Set parameter
http.connection-manager.class = class
org.apache.commons.httpclient.SimpleHttpConnectionManager
2009/11/04 17:31:47:255 IST [DEBUG] DefaultHttpParams - Set parameter
http.protocol.cookie-policy = default
2009/11/04 17:31:47:255 IST [DEBUG] DefaultHttpParams - Set parameter
http.protocol.element-charset = US-ASCII
2009/11/04 17:31:47:255 IST [DEBUG] DefaultHttpParams - Set parameter
http.protocol.content-charset = ISO-8859-1
2009/11/04 17:31:47:255 IST [DEBUG] DefaultHttpParams - Set parameter
http.method.retry-handler =
org.apache.commons.httpclient.defaulthttpmethodretryhand...@13d21d6
2009/11/04 17:31:47:255 IST [DEBUG] DefaultHttpParams - Set parameter
http.dateparser.patterns = [EEE, dd MMM yyyy HH:mm:ss zzz, EEEE,
dd-MMM-yy HH:mm:ss zzz, EEE MMM d HH:mm:ss yyyy, EEE, dd-MMM-yyyy
 HH:mm:ss z, EEE, dd-MMM-yyyy HH-mm-ss z, EEE, dd MMM yy HH:mm:ss z,
EEE dd-MMM-yyyy HH:mm:ss z, EEE dd MMM yyyy HH:mm:ss z, EEE
dd-MMM-yyyy HH-mm-ss z, EEE dd-MMM-yy HH:mm:ss z, EEE dd MMM yy
HH:mm:s
s z, EEE,dd-MMM-yy HH:mm:ss z, EEE,dd-MMM-yyyy HH:mm:ss z, EEE,
dd-MM-yyyy HH:mm:ss z]
2009/11/04 17:31:47:255 IST [DEBUG] HttpClient - Java version: 1.5.0_13
2009/11/04 17:31:47:255 IST [DEBUG] HttpClient - Java vendor: Sun
Microsystems Inc.
2009/11/04 17:31:47:255 IST [DEBUG] HttpClient - Java class path: classpath;
2009/11/04 17:31:47:255 IST [DEBUG] HttpClient - Operating system
name: Windows XP
2009/11/04 17:31:47:255 IST [DEBUG] HttpClient - Operating system
architecture: x86
2009/11/04 17:31:47:255 IST [DEBUG] HttpClient - Operating system version: 5.1
2009/11/04 17:31:47:286 IST [DEBUG] HttpClient - SUN 1.5: SUN (DSA
key/parameter generation; DSA signing; SHA-1, MD5 digests;
SecureRandom; X.509 certificates; JKS keystore; PKIX
CertPathValidator; PK
IX CertPathBuilder; LDAP, Collection CertStores)
2009/11/04 17:31:47:286 IST [DEBUG] HttpClient - SunRsaSign 1.5: Sun
RSA signature provider
2009/11/04 17:31:47:286 IST [DEBUG] HttpClient - SunJSSE 1.5: Sun JSSE
provider(PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
2009/11/04 17:31:47:286 IST [DEBUG] HttpClient - SunJCE 1.5: SunJCE
Provider (implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR,
RC2, PBE, Diffie-Hellman, HMAC)
2009/11/04 17:31:47:286 IST [DEBUG] HttpClient - SunJGSS 1.0: Sun (Kerberos v5)
2009/11/04 17:31:47:286 IST [DEBUG] HttpClient - SunSASL 1.5: Sun SASL
provider(implements client mechanisms for: DIGEST-MD5, GSSAPI,
EXTERNAL, PLAIN, CRAM-MD5; server mechanisms for: DIGEST-MD5, GSSA
PI, CRAM-MD5)
2009/11/04 17:31:47:286 IST [DEBUG] DefaultHttpParams - Set parameter
http.connection-manager.timeout = 30000
2009/11/04 17:31:47:286 IST [DEBUG] DefaultHttpParams - Set parameter
http.connection.timeout = 30000
2009/11/04 17:31:47:286 IST [DEBUG] DefaultHttpParams - Set parameter
http.socket.timeout = 30000
2009/11/04 17:31:47:286 IST [DEBUG] DefaultHttpParams - Set parameter
http.socket.timeout = 30000
2009/11/04 17:31:47:301 IST [DEBUG] DefaultHttpParams - Set parameter
http.authentication.preemptive = false
2009/11/04 17:31:47:301 IST [DEBUG] DefaultHttpParams - Set parameter
http.auth.scheme-priority = [NTLM]
2009/11/04 17:31:47:317 IST [DEBUG] MultiThreadedHttpConnectionManager
- HttpConnectionManager.getConnection:  config =
HostConfiguration[host=https://eumail.rbsres07.net], timeout = 30000
2009/11/04 17:31:47:317 IST [DEBUG] MultiThreadedHttpConnectionManager
- Allocating new connection,
hostConfig=HostConfiguration[host=https://eumail.rbsres07.net]
2009/11/04 17:31:47:317 IST [DEBUG] HttpConnection - Open connection
to server:443
2009/11/04 17:31:47:676 IST [DEBUG] header - >> "POST
/EWS/Exchange.asmx HTTP/1.1[\r][\n]"
2009/11/04 17:31:47:676 IST [DEBUG] HttpMethodBase - Adding Host request header
2009/11/04 17:31:47:692 IST [DEBUG] header - >> "Content-Type:
text/xml; charset=UTF-8[\r][\n]"
2009/11/04 17:31:47:692 IST [DEBUG] header - >> "SOAPAction:
"http://schemas.microsoft.com/exchange/services/2006/messages/FindItem"[\r][\n]";
2009/11/04 17:31:47:692 IST [DEBUG] header - >> "User-Agent: Axis2[\r][\n]"
2009/11/04 17:31:47:692 IST [DEBUG] header - >> "Host: server[\r][\n]"
2009/11/04 17:31:47:692 IST [DEBUG] header - >> "Transfer-Encoding:
chunked[\r][\n]"
2009/11/04 17:31:47:692 IST [DEBUG] header - >> "[\r][\n]"
2009/11/04 17:31:48:286 IST [DEBUG] content - >> "297[\r][\n]"
2009/11/04 17:31:48:286 IST [DEBUG] content - >> "<?xml version='1.0'
encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Body><ns2:FindItem
xmlns:ns
2="http://schemas.microsoft.com/exchange/services/2006/messages";
xmlns="http://schemas.microsoft.com/exchange/services/2006/types";
Traversal="Shallow"><ns2:ItemShape><BaseShape>IdOnly</BaseShape></ns2
:ItemShape><ns2:IndexedPageItemView BasePoint="Beginning"
Offset="0"></ns2:IndexedPageItemView><ns2:ParentFolderIds><DistinguishedFolderId
Id="inbox"><Mailbox><EmailAddress></Email
Address></Mailbox></DistinguishedFolderId></ns2:ParentFolderIds></ns2:FindItem></soapenv:Body></soapenv:Envelope>"
2009/11/04 17:31:48:286 IST [DEBUG] content - >> "[\r][\n]"
2009/11/04 17:31:48:286 IST [DEBUG] content - >> "0"
2009/11/04 17:31:48:286 IST [DEBUG] content - >> "[\r][\n]"
2009/11/04 17:31:48:286 IST [DEBUG] content - >> "[\r][\n]"
2009/11/04 17:31:48:286 IST [DEBUG] EntityEnclosingMethod - Request body sent
2009/11/04 17:31:48:473 IST [DEBUG] header - << "HTTP/1.1 401
Unauthorized[\r][\n]"
2009/11/04 17:31:48:473 IST [DEBUG] header - << "HTTP/1.1 401
Unauthorized[\r][\n]"
2009/11/04 17:31:48:473 IST [DEBUG] header - << "Content-Length: 1656[\r][\n]"
2009/11/04 17:31:48:473 IST [DEBUG] header - << "Content-Type:
text/html[\r][\n]"
2009/11/04 17:31:48:473 IST [DEBUG] header - << "Server:
Microsoft-IIS/6.0[\r][\n]"
2009/11/04 17:31:48:473 IST [DEBUG] header - << "WWW-Authenticate:
Negotiate[\r][\n]"
2009/11/04 17:31:48:473 IST [DEBUG] header - << "WWW-Authenticate: NTLM[\r][\n]"
2009/11/04 17:31:48:473 IST [DEBUG] header - << "X-Powered-By: ASP.NET[\r][\n]"
2009/11/04 17:31:48:473 IST [DEBUG] header - << "Date: Wed, 04 Nov
2009 12:01:48 GMT[\r][\n]"
2009/11/04 17:31:48:473 IST [DEBUG] header - << "[\r][\n]"
2009/11/04 17:31:48:473 IST [DEBUG] HttpMethodDirector - Authorization required
2009/11/04 17:31:48:473 IST [DEBUG] AuthChallengeProcessor - Supported
authentication schemes in the order of preference: [NTLM]
2009/11/04 17:31:48:473 IST [INFO] AuthChallengeProcessor - NTLM
authentication scheme selected
2009/11/04 17:31:48:473 IST [DEBUG] AuthChallengeProcessor - Using
authentication scheme: ntlm
2009/11/04 17:31:48:489 IST [DEBUG] AuthChallengeProcessor -
Authorization challenge processed
2009/11/04 17:31:48:489 IST [DEBUG] HttpMethodDirector -
Authentication scope: NTLM <any realm>@server:443
2009/11/04 17:31:48:520 IST [DEBUG] HttpMethodDirector - Credentials required
2009/11/04 17:31:48:520 IST [DEBUG] HttpMethodDirector - Credentials
provider not available
2009/11/04 17:31:48:536 IST [INFO] HttpMethodDirector - No credentials
available for NTLM <any realm>@server:443
2009/11/04 17:31:48:536 IST [INFO] HTTPSender - Unable to sendViaPost
to url[https://server/EWS/Exchange.asmx] <org.apache.axis2.AxisFault:
Transport error: 401 Error: Unauthorized>org.ap
ache.axis2.AxisFault: Transport error: 401 Error: Unauthorized
        at 
org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:310)
        at 
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:200)
        at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
        at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
        at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:435)
        at 
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
        at 
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
        at 
org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
        at 
com.microsoft.schemas.exchange.services._2006.messages.ExchangeServicesStub.findItem(ExchangeServicesStub.java:11925)
        at 
com.rbsfm.exchangewebservices.ExchangeWSTest.getAllMessageIds(ExchangeWSTest.java:115)
        at 
com.rbsfm.exchangewebservices.ExchangeWSTest.main(ExchangeWSTest.java:86)

2009/11/04 17:31:48:676 IST [DEBUG] content - << "<!DOCTYPE HTML
PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd";>[\r][\n]"
2009/11/04 17:31:48:676 IST [DEBUG] content - <<
"<HTML><HEAD><TITLE>You are not authorized to view this
page</TITLE>[\r][\n]"
2009/11/04 17:31:48:692 IST [DEBUG] content - << "<META
HTTP-EQUIV="Content-Type" Content="text/html;
charset=Windows-1252">[\r][\n]"
2009/11/04 17:31:48:692 IST [DEBUG] content - << "<STYLE
type="text/css">[\r][\n]"
2009/11/04 17:31:48:708 IST [DEBUG] content - << "  BODY { font:
8pt/12pt verdana }[\r][\n]"
2009/11/04 17:31:48:708 IST [DEBUG] content - << "  H1 { font:
13pt/15pt verdana }[\r][\n]"
2009/11/04 17:31:48:723 IST [DEBUG] content - << "  H2 { font:
8pt/12pt verdana }[\r][\n]"
2009/11/04 17:31:48:723 IST [DEBUG] content - << "  A:link { color:
red }[\r][\n]"
2009/11/04 17:31:48:739 IST [DEBUG] content - << "  A:visited { color:
maroon }[\r][\n]"
2009/11/04 17:31:48:739 IST [DEBUG] content - << "</STYLE>[\r][\n]"
2009/11/04 17:31:48:755 IST [DEBUG] content - << "</HEAD><BODY><TABLE
width=500 border=0 cellspacing=10><TR><TD>[\r][\n]"
2009/11/04 17:31:48:755 IST [DEBUG] content - << "[\r][\n]"
2009/11/04 17:31:48:770 IST [DEBUG] content - << "<h1>You are not
authorized to view this page</h1>[\r][\n]"
2009/11/04 17:31:48:770 IST [DEBUG] content - << "You do not have
permission to view this directory or page using the credentials that
you supplied because your Web browser is sending a WWW-Authentica
te header field that the Web server is not configured to accept.[\r][\n]"
2009/11/04 17:31:48:801 IST [DEBUG] content - << "<hr>[\r][\n]"
2009/11/04 17:31:48:817 IST [DEBUG] content - << "<p>Please try the
following:</p>[\r][\n]"
2009/11/04 17:31:48:817 IST [DEBUG] content - << "<ul>[\r][\n]"
2009/11/04 17:31:48:833 IST [DEBUG] content - << "<li>Contact the Web
site administrator if you believe you should be able to view this
directory or page.</li>[\r][\n]"
2009/11/04 17:31:48:833 IST [DEBUG] content - << "<li>Click the <a
href="javascript:location.reload()">Refresh</a> button to try again
with different cred"
2009/11/04 17:31:48:848 IST [DEBUG] content - << "entials.</li>[\r][\n]"
2009/11/04 17:31:48:848 IST [DEBUG] content - << "</ul>[\r][\n]"
2009/11/04 17:31:48:864 IST [DEBUG] content - << "<h2>HTTP Error 401.2
- Unauthorized: Access is denied due to server
configuration.<br>Internet Information Services (IIS)</h2>[\r][\n]"
2009/11/04 17:31:48:864 IST [DEBUG] content - << "<hr>[\r][\n]"
2009/11/04 17:31:48:880 IST [DEBUG] content - << "<p>Technical
Information (for support personnel)</p>[\r][\n]"
2009/11/04 17:31:48:880 IST [DEBUG] content - << "<ul>[\r][\n]"
2009/11/04 17:31:48:895 IST [DEBUG] content - << "<li>Go to <a
href="http://go.microsoft.com/fwlink/?linkid=8180";>Microsoft Product
Support Services</a> and perform a title search for the words <b>HTT
P</b> and <b>401</b>.</li>[\r][\n]"
2009/11/04 17:31:48:926 IST [DEBUG] content - << "<li>Open <b>IIS
Help</b>, which is accessible in IIS Manager (inetmgr),[\r][\n]"
2009/11/04 17:31:48:926 IST [DEBUG] content - << " and search for
topics titled <b>About Security</b>, <b>Authentication</b>, and
<b>About Custom Error Messages</b>.</li>[\r][\n]"
2009/11/04 17:31:48:942 IST [DEBUG] content - << "</ul>[\r][\n]"
2009/11/04 17:31:48:942 IST [DEBUG] content - << "[\r][\n]"
2009/11/04 17:31:48:958 IST [DEBUG] content - <<
"</TD></TR></TABLE></BODY></HTML>[\r][\n]"
2009/11/04 17:31:48:958 IST [DEBUG] HttpMethodBase - Resorting to
protocol version default close connection policy
2009/11/04 17:31:48:973 IST [DEBUG] HttpMethodBase - Should NOT close
connection, using HTTP/1.1
2009/11/04 17:31:48:973 IST [DEBUG] HttpConnection - Releasing
connection back to connection manager.
2009/11/04 17:31:48:973 IST [DEBUG] MultiThreadedHttpConnectionManager
- Freeing connection,
hostConfig=HostConfiguration[host=https://server]
2009/11/04 17:31:49:005 IST [DEBUG] IdleConnectionHandler - Adding
connection at: 1257336109005
2009/11/04 17:31:49:005 IST [DEBUG] MultiThreadedHttpConnectionManager
- Notifying no-one, there are no waiting threads
org.apache.axis2.AxisFault: Transport error: 401 Error: Unauthorized
        at 
org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:310)
        at 
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:200)
        at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)
        at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)
        at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:435)
        at 
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)
        at 
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
        at 
org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
        at 
com.microsoft.schemas.exchange.services._2006.messages.ExchangeServicesStub.findItem(ExchangeServicesStub.java:11925)
        at 
com.rbsfm.exchangewebservices.ExchangeWSTest.getAllMessageIds(ExchangeWSTest.java:115)

*****************************************************



Could someone please help.

Thanks
Nitin Gupta

Reply via email to