I have created a proxy service using Apache camel..
Here is my camel-config.xml file :
<?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 -->
Now my wsdl file is on http://localhost:8280/services/Version.Security?wsdl
and my endpoint url is https://localhost:8243/services/Version.Security.Version.SecurityHttpsSoap11Endpoint
The proxy gets created without any error, but when i invoke the above service in soap UI i get an error in SOAP UI as :
Mon Dec 01 12:55:31 IST 2014:ERROR:org.apache.http.conn.HttpHostConnectException: Connection to https://localhost:8243 refused
org.apache.http.conn.HttpHostConnectException: Connection to https://localhost:8243 refused
at com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager$SoapUIClientConnectionOperator.openConnection(SoapUIMultiThreadedHttpConnectionManager.java:321)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:561)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport$Helper.execute(HttpClientSupport.java:246)
at com.eviware.soapui.impl.wsdl.support.http.HttpClientSupport.execute(HttpClientSupport.java:356)
at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.submitRequest(HttpClientRequestTransport.java:317)
at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:231)
at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:123)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
at com.eviware.soapui.impl.wsdl.support.http.SoapUISSLSocketFactory.connectSocket(SoapUISSLSocketFactory.java:218)
at com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager$SoapUIClientConnectionOperator.openConnection(SoapUIMultiThreadedHttpConnectionManager.java:299)
... 17 more
What is the problem i am unable to figure out..
One more thing, if i remove the below part from camel-config.xml
<cxf:properties>
<entry key="publishedEndpointUrl" value="https://localhost:8243/services/Version.Security.Version.SecurityHttpsSoap11Endpoint" />
</cxf:properties>
The proxy service works perfectly whether the wsdl url is http or https..
Looking forward to your answers. Thanks in advance
If you have load balance server before your cxf services, it makes sense that you define the publishedEndpointUrl to the load balance address.
For you case, it looks like you want to SOAP UI to access other address which has on listener there.