Pardon the non-answer (you'll get a real answer soon I suppose), but I don't
think it is safe to be redirecting SOAP client calls to https like you do
web browser calls.  If your SOAP client is calling on port 80, it is best to
immediately throw an error (i.e., *not* redirect), instead of just silently
switch them over to SSL.  Because even if you redirect, that original SOAP
request was sent to the server unencrypted, and I doubt that's what you
want.

Redirection is to protect grandmothers who don't know computers much who are
about to log into "http://www.mylocalbank.com"; and do bank transfers--here
you silently move them over to https:// so they can do their work.

But your SOAP clients need to be calling your web service on the SSL port,
and using HTTPS.  SOAP client developers need to know what they're doing. 
If they're not doing that, you may have a serious training issue with your
SOAP client programmer (of which my blog entry can possibly
help[1])--because that means he is foolishly sending out sensitive data
unencrypted, and very possibly making other  mistakes as well.

Glen

[1] http://www.jroller.com/gmazza/entry/setting_up_ssl_and_basic


mzha wrote:
> 
> I configured in web.xml of my web-app to redirect http request to https.
> It works well with the browser. But it does not work with my client.
> If my client connects the service with https://... , it works fine, but
> fails if http:// is in use.
> 
> Best regards, 
> 
> Ming
> 
> ===============================================
> I defined the service endpoint like this
> ===============================================
> <jaxws:endpoint id="sessionService"
>     implementor="de.destatis.idb.web.ws.service.cxf.SessionWebServiceImpl" 
>     address="/SessionService"
>     serviceName="SessionService"/> 
> ===============================================
> I set the autoredirect programatically like this
> ===============================================
> Client client =
> this.clientProxyFactory.getClientFactoryBean().getClient();
> HTTPConduit conduit = (HTTPConduit) client.getConduit();
> HTTPClientPolicy clientPolicy = new HTTPClientPolicy();
> clientPolicy.setReceiveTimeout(2 * 60 * 1000);
> clientPolicy.setAutoRedirect(true);
> conduit.setClient(clientPolicy);
> ===============================================
> This is the log:
> ===============================================
> 13.01.2009 16:04:26 org.apache.cxf.transport.http.HTTPConduit prepare
> INFO: AutoRedirect is turned on.
> 13.01.2009 16:04:26 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Could not send Message.
>       at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
>       at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
>       at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:466)
>       at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
>       at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
>       at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>       at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
>       at $Proxy49.login(Unknown Source)
>       at
> de.destatis.idb.web.ws.client.cxf.CXFWebServiceClientProxy$SessionWebServiceClientImpl.login(CXFWebServiceClientProxy.java:179)
>       at
> de.destatis.idb.test.TestIDBSessionServiceClient.main(TestIDBSessionServiceClient.java:35)
> Caused by: java.io.IOException: Illegal Protocol https for HTTP
> URLConnection Factory.
>       at
> org.apache.cxf.transport.http.HttpURLConnectionFactoryImpl.createConnection(HttpURLConnectionFactoryImpl.java:44)
>       at
> org.apache.cxf.transport.http.HTTPConduit.retransmit(HTTPConduit.java:1582)
>       at
> org.apache.cxf.transport.http.HTTPConduit.redirectRetransmit(HTTPConduit.java:1446)
>       at
> org.apache.cxf.transport.http.HTTPConduit.processRetransmit(HTTPConduit.java:1367)
>       at
> org.apache.cxf.transport.http.HTTPConduit.access$300(HTTPConduit.java:135)
>       at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRetransmits(HTTPConduit.java:1910)
>       at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1937)
>       at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1867)
>       at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
>       at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:595)
>       at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
>       ... 9 more
> Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could not
> send Message.
>       at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145)
>       at $Proxy49.login(Unknown Source)
>       at
> de.destatis.idb.web.ws.client.cxf.CXFWebServiceClientProxy$SessionWebServiceClientImpl.login(CXFWebServiceClientProxy.java:179)
>       at
> de.destatis.idb.test.TestIDBSessionServiceClient.main(TestIDBSessionServiceClient.java:35)
> Caused by: org.apache.cxf.interceptor.Fault: Could not send Message.
>       at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
>       at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
>       at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:466)
>       at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
>       at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
>       at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>       at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
>       ... 3 more
> Caused by: java.io.IOException: Illegal Protocol https for HTTP
> URLConnection Factory.
>       at
> org.apache.cxf.transport.http.HttpURLConnectionFactoryImpl.createConnection(HttpURLConnectionFactoryImpl.java:44)
>       at
> org.apache.cxf.transport.http.HTTPConduit.retransmit(HTTPConduit.java:1582)
>       at
> org.apache.cxf.transport.http.HTTPConduit.redirectRetransmit(HTTPConduit.java:1446)
>       at
> org.apache.cxf.transport.http.HTTPConduit.processRetransmit(HTTPConduit.java:1367)
>       at
> org.apache.cxf.transport.http.HTTPConduit.access$300(HTTPConduit.java:135)
>       at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRetransmits(HTTPConduit.java:1910)
>       at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1937)
>       at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1867)
>       at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
>       at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:595)
>       at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
>       ... 9 more
> 

-- 
View this message in context: 
http://www.nabble.com/problem-with-redirect-http-request-to-https-tp21438244p21443997.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to