You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by bertieBotts <ge...@gmail.com> on 2008/09/02 07:27:15 UTC

Authentication with Axis2

Hi,

I am attempting to connect to MSExchange Web Services.

The authenticator bit of my code is:
			exStub=new ExchangeWebServiceStub(configContext,ewsUrl);
			Options options = exStub._getServiceClient().getOptions();
			HttpTransportProperties.Authenticator authenticator = new
HttpTransportProperties.Authenticator();
			List authScheme = new ArrayList();
			//authScheme.add(HttpTransportProperties.Authenticator.NTLM);
			authScheme.add(HttpTransportProperties.Authenticator.BASIC);
			//authScheme.add(HttpTransportProperties.Authenticator.DIGEST);
			authenticator.setAuthSchemes(authScheme);
			authenticator.setUsername(userName);
			authenticator.setPassword(password);
			authenticator.setHost(host);
			authenticator.setDomain(domain);
			authenticator.setPort(port);
			options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);
			ServiceClient serviceClient=exStub._getServiceClient();
			serviceClient.setOptions(options);

When I attempt to connect I get:

DEBUG] HttpClient - Operating system architecture: x86
[DEBUG] HttpClient - Operating system version: 5.1
[DEBUG] HttpClient - SUN 1.42: SUN (DSA key/parameter generation; DSA
signing; SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS keystore;
PKIX CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores)
[DEBUG] HttpClient - SunJSSE 1.42: Sun JSSE provider(implements RSA
Signatures, PKCS12, SunX509 key/trust factories, SSLv3, TLSv1)
[DEBUG] HttpClient - SunRsaSign 1.42: SUN's provider for RSA signatures
[DEBUG] HttpClient - SunJCE 1.42: SunJCE Provider (implements DES, Triple
DES, AES, Blowfish, PBE, Diffie-Hellman, HMAC-MD5, HMAC-SHA1)
[DEBUG] HttpClient - SunJGSS 1.0: Sun (Kerberos v5)
[DEBUG] DefaultHttpParams - Set parameter http.connection.timeout = 30000
[DEBUG] DefaultHttpParams - Set parameter http.socket.timeout = 30000
[DEBUG] DefaultHttpParams - Set parameter http.socket.timeout = 30000
[DEBUG] DefaultHttpParams - Set parameter http.authentication.preemptive =
false
[DEBUG] DefaultHttpParams - Set parameter http.auth.scheme-priority =
[Basic]
[DEBUG] MultiThreadedHttpConnectionManager -
HttpConnectionManager.getConnection:  config =
HostConfiguration[host=https://psecc001.poc.ssi.govt.nz], timeout = 0
[DEBUG] MultiThreadedHttpConnectionManager - Allocating new connection,
hostConfig=HostConfiguration[host=https://psecc001.poc.ssi.govt.nz]
[DEBUG] HttpConnection - Open connection to psecc001.poc.ssi.govt.nz:443
[DEBUG] header - >> "POST /EWS/Exchange.asmx HTTP/1.1[\r][\n]"
[DEBUG] HttpMethodBase - Adding Host request header
[DEBUG] header - >> "Content-Type: text/xml; charset=UTF-8[\r][\n]"
[DEBUG] header - >> "SOAPAction:
"http://schemas.microsoft.com/exchange/services/2006/messages/FindItem"[\r][\n]"
[DEBUG] header - >> "User-Agent: Axis2[\r][\n]"
[DEBUG] header - >> "Host: psecc001.poc.ssi.govt.nz[\r][\n]"
[DEBUG] header - >> "Content-Length: 897[\r][\n]"
[DEBUG] header - >> "[\r][\n]"
[DEBUG] content - >> "<?xml version='1.0'
encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header><ExchangeImpersonation
xmlns="http://schemas.microsoft.com/exchange/services/2006/types"
soapenv:mustUnderstand="0"><ConnectingSID><PrimarySmtpAddress>abain001@poc.ssi.govt.nz</PrimarySmtpAddress></ConnectingSID></ExchangeImpersonation></soapenv:Header><soapenv:Body><FindItem
xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
Traversal="Shallow"><ItemShape><BaseShape
xmlns="http://schemas.microsoft.com/exchange/services/2006/types">IdOnly</BaseShape></ItemShape><CalendarView
StartDate="2008-08-03T17:18:34.317+12:00"
EndDate="2008-10-02T17:18:34.317+12:00"
/><ParentFolderIds><DistinguishedFolderId
xmlns="http://schemas.microsoft.com/exchange/services/2006/types"
Id="calendar"
/></ParentFolderIds></FindItem></soapenv:Body></soapenv:Envelope>"
[DEBUG] EntityEnclosingMethod - Request body sent
[DEBUG] header - << "HTTP/1.1 401 Unauthorized[\r][\n]"
[DEBUG] header - << "Content-Length: 1656[\r][\n]"
[DEBUG] header - << "Content-Type: text/html[\r][\n]"
[DEBUG] header - << "Server: Microsoft-IIS/6.0[\r][\n]"
[DEBUG] header - << "WWW-Authenticate: Basic
realm="poc.ssi.govt.nz"[\r][\n]"
[DEBUG] header - << "X-Powered-By: ASP.NET[\r][\n]"
[DEBUG] header - << "Date: Tue, 02 Sep 2008 05:18:36 GMT[\r][\n]"
[DEBUG] HttpMethodDirector - Authorization required
[DEBUG] AuthChallengeProcessor - Supported authentication schemes in the
order of preference: [Basic]
[INFO] AuthChallengeProcessor - Basic authentication scheme selected
[DEBUG] AuthChallengeProcessor - Using authentication scheme: basic
[DEBUG] AuthChallengeProcessor - Authorization challenge processed
[DEBUG] HttpMethodDirector - Authentication scope: BASIC
'poc.ssi.govt.nz'@psecc001.poc.ssi.govt.nz:443
[DEBUG] HttpMethodDirector - Credentials required
[DEBUG] HttpMethodDirector - Credentials provider not available
[INFO] HttpMethodDirector - No credentials available for BASIC
'poc.ssi.govt.nz'@psecc001.poc.ssi.govt.nz:443
[INFO] HTTPSender - Unable to sendViaPost to
url[https://psecc001.poc.ssi.govt.nz/EWS/Exchange.asmx]
<org.apache.axis2.AxisFault: Transport error: 401 Error:
Unauthorized>org.apache.axis2.AxisFault: Transport error: 401 Error:
Unauthorized
	at
org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:298)
	at
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:192)
	at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77)


Why is "Credentials provider not available"?

Cheers
George

-- 
View this message in context: http://www.nabble.com/Authentication-with-Axis2-tp19264315p19264315.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org