Any chance you can try this with 2.2.6-SNAPSHOT? I made some attempts with
2.2.6 to pass the auth information down further into the JDK so the JDK
algorithms may be able to use it. The primary reasons were for HTTPs proxy
support and NTLM support, but it may also apply to this.
Dan
On Tue January 12 2010 8:04:47 pm Lucas Madar wrote:
> I'm trying to write a service consumer that must retrieve information
> from a server with both https and digest authentication. I have no
> control over the server.
>
> After a day of playing around, CXF works... after about 30 seconds for a
> very simple call. This seems to happen because in the background it is
> making about 20 requests to the server with invalid authentication
> information (the username it is using is not the one supplied in code,
> but instead the one that Java defaults to in Java's own digest
> authentication scheme). After a loop of about 20 retries, it finally
> gets to the point in the cxf code where it correctly sends the
> authentication information and the request succeeds. Connecting to
> another webservice with http (not https) and digest authentication
> appears to work correctly.
>
> Here's a stacktrace. Apparently, calling
> HttpsUrlConnectionImpl.getResponseCode() calls the next
> getResponseCode(), which then submits the entire query to the server.
> This query fails with "authentication failed," so internally it retries
> auth, most likely a set number of times. When it finally returns,
> everything works out fine.
>
> DelegateHttpsURLConnection(HttpURLConnection).getInputStream()
> line: 1007 [local variables unavailable]
> DelegateHttpsURLConnection(HttpURLConnection).getResponseCode()
> line: 373 [local variables unavailable]
> DelegateHttpsURLConnection(HttpURLConnection).getInputStream()
> line: 1078 [local variables unavailable]
> DelegateHttpsURLConnection(HttpURLConnection).getResponseCode()
> line: 373 [local variables unavailable]
> HttpsURLConnectionImpl.getResponseCode() line: 318 [local variables
> unavailable]
> HTTPConduit.processRetransmit(HttpURLConnection, Message,
> CacheAndWriteOutputStream) line: 1453
> HTTPConduit.access$300(HTTPConduit, HttpURLConnection, Message,
> CacheAndWriteOutputStream) line: 143
> HTTPConduit$WrappedOutputStream.handleRetransmits() line: 2025
> HTTPConduit$WrappedOutputStream.handleResponse() line: 2052
> HTTPConduit$WrappedOutputStream.close() line: 1982
> HTTPConduit(AbstractConduit).close(Message) line: 66
> HTTPConduit.close(Message) line: 637
>
> MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(Messa
> ge) line: 62
> PhaseInterceptorChain.doIntercept(Message) line: 236
> ClientImpl.invoke(BindingOperationInfo, Object[],
> Map<String,Object>, Exchange) line: 483
> ClientImpl.invoke(BindingOperationInfo, Object[], Exchange) line: 309
> ClientImpl.invoke(BindingOperationInfo, Object...) line: 261
> JaxWsClientProxy(ClientProxy).invokeSync(Method,
> BindingOperationInfo, Object[]) line: 73
> JaxWsClientProxy.invoke(Object, Method, Object[]) line: 124
> $Proxy55.getClientToken(TokenSpecification) line: not available
> VEI.getValidToken(Customer) line: 582
>
> Here's the code I'm using to set up digest authentication:
> CommonServiceSoap commonService = service.getCommonServiceSoap();
>
> Client client = ClientProxy.getClient( veCommonService );
> Conduit conduit = client.getConduit();
>
> if( conduit instanceof HTTPConduit )
> {
> HTTPConduit httpConduit = (HTTPConduit) conduit;
> HTTPClientPolicy httpClientPolicy =
> httpConduit.getClient();
>
> httpClientPolicy.setAllowChunking( false );
>
> AuthorizationPolicy policy = new AuthorizationPolicy();
> policy.setUserName( vePropUserID );
> policy.setPassword( vePropPassword );
>
> httpConduit.setAuthorization( policy );
> httpConduit.setAuthSupplier( new DigestAuthSupplier() );
> }
>
> Any help or guidance would be greatly appreciated.
>
> Thanks!
> Lucas Madar
>
--
Daniel Kulp
[email protected]
http://www.dankulp.com/blog