Web services 调用camel代理Web服务时出错
我已经使用Apache camel创建了一个代理服务 这是我的camel-config.xml文件:Web services 调用camel代理Web服务时出错,web-services,proxy,cxf,apache-camel,wss4j,Web Services,Proxy,Cxf,Apache Camel,Wss4j,我已经使用Apache camel创建了一个代理服务 这是我的camel-config.xml文件: <?xml version="1.0" encoding="UTF-8"?> <!-- START SNIPPET: e1 --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instanc
<?xml version="1.0" encoding="UTF-8"?>
<!-- START SNIPPET: e1 -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xmlns:cxfcore="http://cxf.apache.org/core"
xmlns:sec="http://cxf.apache.org/configuration/security"
xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
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-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd
">
<cxfcore:bus/>
<httpj:engine-factory bus="cxf">
<httpj:engine port='8243'>
<httpj:tlsServerParameters>
<sec:keyManagers keyPassword="skpass">
<sec:keyStore file="D:/eclipse/tomcat-7.0.29-camel/webapps/Version.Security/WEB-INF/classes/certs/serviceKeystore.jks" password="sspass" type="JKS"/>
</sec:keyManagers>
<sec:trustManagers>
<sec:keyStore file="D:/eclipse/tomcat-7.0.29-camel/webapps/Version.Security/WEB-INF/classes/certs/serviceKeystore.jks" password="sspass" type="JKS"/>
</sec:trustManagers>
<sec:cipherSuitesFilter>
<sec:include>.*_WITH_3DES_.*</sec:include>
<sec:include>.*_WITH_DES_.*</sec:include>
<sec:exclude>.*_WITH_NULL_.*</sec:exclude>
<sec:exclude>.*_DH_anon_.*</sec:exclude>
</sec:cipherSuitesFilter>
<sec:clientAuthentication want="true" required="false"/>
</httpj:tlsServerParameters>
</httpj:engine>
</httpj:engine-factory>
<!-- bean that enriches the SOAP request -->
<bean id="enrichBean" class="org.apache.camel.example.cxf.proxy.EnrichBean"/>
<bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
<bean id="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
<bean id="wss4jInConfiguration" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<property name="properties">
<map>
<entry key="action" value="UsernameToken Timestamp"/>
<entry key="passwordType" value="PasswordText" />
<entry>
<key>
<value>passwordCallbackRef</value>
</key>
<ref bean="passwordCallback"/>
</entry>
</map>
</property>
</bean>
<bean id="passwordCallback" class="org.apache.camel.example.cxf.proxy.UTPasswordCallback"/>
<!-- this is the CXF web service we use as the front end -->
**<cxf:cxfEndpoint id="securityService"
address="http://localhost:8280/services/Version.Security"
endpointName="s:Version.SecurityHttpsSoap11Endpoint"
serviceName="s:Version.Security"
wsdlURL="etc/Version.Security.wsdl"
xmlns:s="http://axisversion.sample">
<cxf:properties>
<entry key="publishedEndpointUrl" value="https://localhost:8243/services/Version.Security.Version.SecurityHttpsSoap11Endpoint" />
</cxf:properties>**
<cxf:inInterceptors>
<ref bean="loggingInInterceptor"/>
<ref bean="wss4jInConfiguration"/>
</cxf:inInterceptors>
<cxf:outInterceptors>
<ref bean="loggingOutInterceptor"/>
</cxf:outInterceptors>
</cxf:cxfEndpoint>
<!-- this is the Camel route which proxies the real web service and forwards SOAP requests to it -->
<camelContext xmlns="http://camel.apache.org/schema/spring">
<!-- property which contains port number -->
<propertyPlaceholder id="properties" location="classpath:incident.properties,file:target/custom.properties"/>
<endpoint id="callRealWebService" uri="http://10.115.115.115:8080/axis2/services/Version.Security?throwExceptionOnFailure=false"/>
<route>
<!-- CXF consumer using MESSAGE format -->
<from uri="cxf:bean:securityService?dataFormat=PAYLOAD"/>
<!-- log input received -->
<to uri="log:input"/>
<!-- enrich the input by ensure the incidentId parameter is set -->
<to uri="bean:enrichBean"/>
<!-- opp removing headers... testing -->
<removeHeaders pattern="CamelHttp*" />
<!-- send proxied request to real web service -->
<to ref="callRealWebService"/>
<!-- log answer from real web service -->
<to uri="log:output"/>
</route>
</camelContext>
</beans>
<!-- END SNIPPET: e1 -->
我想不出有什么问题
还有一件事,如果我从camel-config.xml中删除下面的部分
<cxf:properties>
<entry key="publishedEndpointUrl" value="https://localhost:8243/services/Version.Security.Version.SecurityHttpsSoap11Endpoint" />
</cxf:properties>
无论wsdl url是http还是https,代理服务都能完美地工作
期待你的回答。提前感谢如果您的cxf服务之前有负载平衡服务器,那么您可以将PublishedPointURL定义为负载平衡地址 对于您的情况,看起来您希望通过SOAP UI访问侦听器上的其他地址
<cxf:properties>
<entry key="publishedEndpointUrl" value="https://localhost:8243/services/Version.Security.Version.SecurityHttpsSoap11Endpoint" />
</cxf:properties>