I tried this and the problem remained the same. I am useing camel 2.2.0.fuse-01-00.
willem.jiang wrote: > > Which version of camel are you using? > There is a NTLMAuthenticationHttpClientConfigurer[1] in camel trunk, you > can use it for your NTLM Proxy Authentication. > > [1]https://svn.apache.org/repos/asf/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/NTLMAuthenticationHttpClientConfigurer.java > > Willem > > > lekkie wrote: >> I am trying to fetch a resource using the camel-http component and I am >> running my application behind a proxy server who uses NTLM for >> authentication. >> >> Each time I try to connect it gives an I/O Exception, see error below: >> >> 17:18:29,747 | INFO | Service-thread-2 | HttpMethodDirector >> | >> ns.httpclient.HttpMethodDirector 439 | I/O exception >> (java.net.ConnectException) caught when processing request: Connection >> refused: connect >> 17:18:29,747 | INFO | Service-thread-2 | HttpMethodDirector >> | >> ns.httpclient.HttpMethodDirector 445 | Retrying request >> 17:18:30,779 | INFO | Service-thread-2 | HttpMethodDirector >> | >> ns.httpclient.HttpMethodDirector 439 | I/O exception >> (java.net.ConnectException) caught when processing request: Connection >> refused: connect >> 17:18:30,779 | INFO | Service-thread-2 | HttpMethodDirector >> | >> ns.httpclient.HttpMethodDirector 445 | Retrying request >> 17:18:31,795 | INFO | Service-thread-2 | HttpMethodDirector >> | >> ns.httpclient.HttpMethodDirector 439 | I/O exception >> (java.net.ConnectException) caught when processing request: Connection >> refused: connect >> 17:18:31,795 | INFO | Service-thread-2 | HttpMethodDirector >> | >> ns.httpclient.HttpMethodDirector 445 | Retrying request >> 17:18:32,843 | ERROR | Service-thread-2 | DefaultErrorHandler >> | >> java.net.ConnectException: Connection refused: connect >> at java.net.PlainSocketImpl.socketConnect(Native Method) >> >> >> See snippet: >> >> <bean id="http" class="org.apache.camel.component.http.HttpComponent"> >> <property name="camelContext" ref="camel"/> >> <property name="httpClientConfigurer" ref="myHTTPClientConfigurer"/> >> </bean> >> >> <bean id="myHTTPClientConfigurer" >> class="com.interswitchng.techquest.nmr_aero_http_provider_bundle.MyHttpClientConfigurer"> >> <property name="sslPort" value="443"/> >> <property name="keystore" value="${keystore-file}"/> >> <property name="keystorePassword" value="${keystore-password}"/> >> <property name="truststore" value="${keystore-file}"/> >> <property name="truststorePassword" value="${keystore-password}"/> >> <property name="keyPassword" value="${key-password}"/> >> <property name="proxyHost" value="${proxy-ip}"/> >> <property name="proxyPort" value="${proxy-port}"/> >> <property name="proxyUsername" value="${proxy-username}"/> >> <property name="proxyPassword" value="${proxy-password}"/> >> <property name="domain" value="${proxy-domain}"/> >> </bean> >> >> <osgi:camelContext id="camel" >> xmlns="http://camel.apache.org/schema/spring" >> trace="true"> >> <endpoint id="httpEndpoint" >> uri="${aero-webservice-url}?username=${auth-username}&password=${auth-password}&httpClient.authenticationPreemptive=true"/> >> <route> >> <from uri="nmr:aeroHTTPService"/> >> <setHeader >> headerName="CamelHttpMethod"><constant>POST</constant></setHeader> >> <transform><simple>XML=${in.body}</simple></transform> >> <setHeader >> headerName="CamelHttpQuery"><simple>${in.body}</simple></setHeader> >> <to ref="httpEndpoint"/> >> </route> >> </osgi:camelContext> >> >> >> Below is MyHttpClientConfigurer: >> >> public void configureHttpClient(HttpClient httpClient) >> { >> ProtocolSocketFactory protocolSocketFactory = null; >> try >> { >> protocolSocketFactory = new SSLProtocolSocketFactory(); >> System.setProperty("javax.net.ssl.keyStore", keystore); >> System.setProperty("javax.net.ssl.keyStorePassword", >> keystorePassword); >> System.setProperty("javax.net.ssl.trustStore", truststore); >> System.setProperty("javax.net.ssl.trustStorePassword", >> truststorePassword); >> System.setProperty("javax.net.ssl.keyPassword", >> keyPassword); >> >> HostConfiguration hostConfiguration = >> httpClient.getHostConfiguration(); >> hostConfiguration.setProxy(proxyHost, proxyPort); >> HttpState httpState = httpClient.getState(); >> AuthScope authscope = new AuthScope(null, proxyPort, null); >> Credentials credentials = new NTCredentials(proxyUsername, >> proxyPassword, "", domain); >> httpState.setProxyCredentials(authscope, credentials); >> List authPrefs = new ArrayList(); >> authPrefs.add(AuthPolicy.NTLM); >> // Credentials credentials = new >> UsernamePasswordCredentials(proxyUsername, proxyPassword); >> // httpState.setProxyCredentials(authscope, credentials); >> HttpClientParams httpClientParams = httpClient.getParams(); >> >> httpClientParams.setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, >> authPrefs); >> >> } >> catch (Exception e) >> { >> e.printStackTrace(); >> } >> Protocol protocol = new Protocol("https", protocolSocketFactory, >> sslPort); >> Protocol.registerProtocol("https", protocol); >> } >> >> >> WHat am I doing wrong/ > > > -- View this message in context: http://old.nabble.com/NTLM-Proxy-Authentication-with-camel-http-failed-tp28670668p28678415.html Sent from the Camel - Users mailing list archive at Nabble.com.