使用servlet传输Jboss fuse 6.3公开https camel cxf webservice

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用servlet传输Jboss fuse 6.3公开https camel cxf webservice相关的知识,希望对你有一定的参考价值。

我想公开camel cxf webservice作为https我已完成以下配置并且部署成功,但我得到连接被拒绝https://localhost:8443

我在配置中遗漏了什么?

我使用Jboss fuse 6.3,Jboss Eap 6.4,camel 2.17和JDK 1.8

1.)我使用下面的命令创建了一个密钥库,并将其放在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.)我在standalone-full.xml中启用了https连接器,如下所示:

<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>

套接字绑定https:

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

4.)端点配置:

<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>

Veb.hml:

<?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>
答案

看起来您在HTTPS连接器SSL配置(信任)上指定的密钥别名与您在创建密钥库时使用的别名(jbossfuse)不匹配。

试试:

<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>

以上是关于使用servlet传输Jboss fuse 6.3公开https camel cxf webservice的主要内容,如果未能解决你的问题,请参考以下文章

JBoss Fuse - 如何使用不同的 CXF 版本

如何使用JBoss Fuse(camel)将JSON解组为多个项目?

pax-jdbc PostgreSQL JBoss Fuse

通告红帽JBoss Fuse及JBoss A-MQ所用Karaf远程代码执行漏洞 安全威胁

将 Camel CXF 代理部署到 Red Hat JBoss Fuse

玩转红帽JBoss Fuse|红帽技术Open讲