Hallo,

I want to access a Webservice over HTTPS.

In order to do so I configured the 'http:conduit' element in my cxf.xml.

This cxf.xml is used by a webservice client inside of a servlet, so
I put the cxf.xml beneath the .../WEB-INF/classes directory.

The Service en port Object can be created without any problems.
But as soon as I call a method in the webservice, I get an Exception
concerning the use of 'http' protocol (see below).

Here are my web.xml and the cxf.xml

............... web.xml ...............................................

<?xml version="1.0" encoding="UTF-8"?>
<web-app
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns="http://java.sun.com/xml/ns/javaee";
        xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                            http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
        id="MyClient"
        version="2.5">

        <display-name>MyClient</display-name>

        <context-param>
                <param-name>webAppRootKey</param-name>
                <param-value>MyClient</param-value>
        </context-param>

        <listener>
                <listener-class>
                        org.springframework.web.util.Log4jConfigListener
                </listener-class>
        </listener>

        <servlet>
                <servlet-name>SomeServlet</servlet-name>
                <servlet-class>
                        some.other.example.SomeServlet
                </servlet-class>
        </servlet>
        <servlet-mapping>
                <servlet-name>SomeServlet</servlet-name>
                <url-pattern>/SomeServlet</url-pattern>
        </servlet-mapping>

</web-app>

............... cxf.xml ...............................................

<beans
        xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns:sec="http://cxf.apache.org/configuration/security";
        xmlns:http="http://cxf.apache.org/transports/http/configuration";
        xmlns:jaxws="http://java.sun.com/xml/ns/jaxws";
        xmlns:cxf="http://cxf.apache.org/core";
        xsi:schemaLocation="
                http://cxf.apache.org/core
                http://cxf.apache.org/schemas/core.xsd
                http://cxf.apache.org/configuration/security
                http://cxf.apache.org/schemas/configuration/security.xsd
                http://cxf.apache.org/transports/http/configuration
                http://cxf.apache.org/schemas/configuration/http-conf.xsd
                http://www.springframework.org/schema/beans
                
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>

        <http:conduit name="{http://this.is.my.namespace}MyPort.http-conduit";>

                <http:tlsClientParameters secureSocketProtocol="SSL">
                        <sec:keyManagers keyPassword="topsecret">
                                <sec:keyStore type="JKS" password="topsecret" 
file="/opt/tomcat/conf/tpay/mykeystore.keystore"/>
                        </sec:keyManagers>
                        <sec:trustManagers>
                                <sec:keyStore type="JKS" password="changeit" 
file="/opt/tomcat/conf/tpay/mytruststore.keystore"/>
                        </sec:trustManagers>

                        <sec:cipherSuitesFilter>
                                <!-- these filters ensure that a ciphersuite 
with
                  export-suitable or null encryption is used,
                  but exclude anonymous Diffie-Hellman key change as
                  this is vulnerable to man-in-the-middle attacks -->
                                <sec:include>.*_EXPORT_.*</sec:include>
                                <sec:include>.*_EXPORT1024_.*</sec:include>
                                <sec:include>.*_WITH_DES_.*</sec:include>
                                <sec:include>.*_WITH_NULL_.*</sec:include>
                                <sec:exclude>.*_DH_anon_.*</sec:exclude>
                        </sec:cipherSuitesFilter>
                </http:tlsClientParameters>

                <http:client ContentType="text/xml"/>

        </http:conduit>

</beans>

............... the code with the webservice call 
...............................................

   QName myWebServiceName =
      new QName("http://this.is.my.namespace";, "MyWebService");
   wsdlURL = new URL("https://this.is.my.namespace/services/MyService"; + 
"?wsdl");

   myWebService = new WebService(wsdlURL, myWebServiceName );
   port = myWebService .getMyPort();

............... the Exception ...............................................

INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
        at 
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:48)
        at 
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:221)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222)
        at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
        at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:177)
        at $Proxy35.delete(Unknown Source)
        at com.tsystems.tpay.micromoney.ws.MicroMoneyWsClient.delete(Unknown 
Source)
        at com.tsystems.tpay.micromoney.ws.MicroMoneyWsClient.doPost(Unknown 
Source)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
        at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.io.IOException: Illegal Protocol http for HTTPS URLConnection 
Factory.
        at 
org.apache.cxf.transport.https.HttpsURLConnectionFactory.createConnection(HttpsURLConnectionFactory.java:124)
        at 
org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:480)
        at 
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
        ... 22 more

I have tried to add i.e. 'secureSocketProtocol="SSL"' to the 
'http:tlsClientParameters' element in the cxf file, but nothings helps.
The problem is somewhere in my configuration, but I cannot solve it due to lack 
of sensible documentation.
Also I cannot verify (in logs) of the cxf.xml is really evaluated.
Any Help would be welcome.

Harry

Reply via email to