Search code examples
javaweb-servicesapache-camelcxfjbossfuse

Exposing https camel cxf webservice using servlet transport Jboss fuse 6.3


I wanted to expose camel cxf webservice as https i have done the below configurations and deployment is successfull,but iam getting connection refused https://localhost:8443

Am i missing something in my configuration?

Iam using Jboss fuse 6.3,Jboss Eap 6.4,camel 2.17 and JDK 1.8

1.) I have created a keystore using below command and placed it in C:\Temp\truststore:

keytool -genkey -keyalg RSA -sigalg SHA1withRSA -validity 730 -alias jbossfuse -keypass password -storepass password -keystore jbossfuse-dev.jks -dname cn=localhost

2.) I have enabled the https connector in standalone-full.xml as below:

<subsystem xmlns="urn:jboss:domain:web:2.2" default-virtual-server="default-host" native="false">
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
            <connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
                <ssl name="https" key-alias="trust" password="password" certificate-key-file="C:/Temp/truststore/jbossfuse-dev.jks"/>
            </connector>
            <virtual-server name="default-host" enable-welcome-root="true">
                <alias name="localhost"/>
                <alias name="example.com"/>
            </virtual-server>
        </subsystem>

Socket binding https :

    <socket-binding name="https" port="8443"/>

4.) Endpoint configuration:

<http:conduit name="*.http-conduit"
                xmlns:sec="http://cxf.apache.org/configuration/security" xmlns="http://cxf.apache.org/transports/http/configuration">
                <http:tlsClientParameters disableCNCheck="true">
                    <sec:trustManagers>
                        <sec:keyStore type="JKS" password="password"
                            file="C:\\Temp\\truststore\\jbossfuse-dev.jks" />
                    </sec:trustManagers>
                </http:tlsClientParameters>
</http:conduit>


<cxf:cxfEndpoint id="authentication" xmlns:nms="http://tempuri.org/"
            address="/authenticationProxy"
            endpointName="nms:BasicHttpBinding_ITestAuthenticationService" 
            serviceName="nms:TestAuthenticationService"
            wsdlURL="wsdl/Authentication/Authentication.wsdl" loggingFeatureEnabled="true">
            <cxf:properties>
                <entry key="dataFormat" value="PAYLOAD" />
            </cxf:properties>
</cxf:cxfEndpoint> 

5.) Camel Route xml:

<route id="AuthInproxy">
            <from id="Authentication" uri="cxf:bean:authentication"/>
            <doTry id="_doTry1">
                <to uri="direct:AuthInProvider"/>
                <doCatch id="_doCatch1">
                    <exception>java.lang.Exception</exception>
                    <handled>
                        <constant>true</constant>
                    </handled>
                </doCatch>
            </doTry>
  </route>

Web.xml :

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
          http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
           version="2.5">
    <display-name>ssl-cxf</display-name>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:META-INF/spring/*.xml</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

  <servlet>
    <servlet-name>CXFServlet</servlet-name>
    <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/*</url-pattern>
  </servlet-mapping> 

</web-app>

Solution

  • Looks like the key-alias that you specified on the HTTPS connector SSL configuration (trust), does not match the alias you used when you created the keystore (jbossfuse).

    Try with:

    <connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
        <ssl name="https" key-alias="jbossfuse" password="password" certificate-key-file="C:/Temp/truststore/jbossfuse-dev.jks"/>
    </connector>