Java CXF HTTPS客户端错误

时间:2014-12-05 17:26:36

标签: java spring apache cxf

我已经搜索并搜索了我在互联网上找到的几种不同的解决方案,包括这个网站。但是,我的问题仍然存在。我正在尝试使用弹簧配置编写CXF(3.0.2)https客户端。无论我尝试什么,我都会收到以下错误:

javax.xml.ws.soap.SOAPFaultException: No conduit initiator was found for the namespace http://schemas.xmlsoap.org/soap/http

我猜测这意味着我的CXF没有正确初始化,但我无法弄清楚我做错了什么。我遵循了CXF指南和示例。这是我的Spring配置:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:context="http://www.springframework.org/schema/context" 
  xmlns:sec="http://cxf.apache.org/configuration/security"
  xmlns:http="http://cxf.apache.org/transports/http/configuration"
  xmlns:jaxws="http://cxf.apache.org/jaxws" 
  xmlns:test123="http://example.com/XXX/ServiceDefinition/WSDLServiceClient/TestJunctionImpl" 
  xsi:schemaLocation="
      http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context.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://cxf.apache.org/core 
      http://cxf.apache.org/schemas/core.xsd                 
      http://cxf.apache.org/jaxws
      http://cxf.apache.org/schemas/jaxws.xsd">

  <http:conduit name="*.http-conduit">

    <http:tlsClientParameters>
      <sec:keyManagers keyPassword="password">
        <sec:keyStore type="JKS" password="password"
                      file="my/file/dir/Morpit.jks"/>
      </sec:keyManagers>
      <sec:trustManagers>
        <sec:keyStore type="JKS" password="password"
                      file="my/file/dir/Truststore.jks"/>
      </sec:trustManagers>
    </http:tlsClientParameters>
    <http:authorization>
      <sec:UserName>username</sec:UserName>
      <sec:Password>password</sec:Password>
    </http:authorization>
    <http:client AutoRedirect="true" Connection="Keep-Alive"/>

  </http:conduit>

    <jaxws:client id="testJunctionJaxWSBean"
          serviceClass="com.example.service.client.TestJunction"
          address="https://example.com:19000/XXX/Services/TestJunction"
          serviceName="test123:TestJunctionImpl" 
          endpointName="test123:TestJunctionEndpoint">
    </jaxws:client>

</beans>

我的classpath上没有cxf.xml。我需要一个吗?我已经在Spring配置中包含了所有内容,如Apache配置指南所述。

感谢任何帮助。感谢。

0 个答案:

没有答案