You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "peter.berkman" <pe...@cornergrove.com> on 2012/11/12 16:52:21 UTC

Mixed HTTP and HTTPS Listeners Using CXF

so, now that the issues around dynamic configuration are resolved, the next
problem I'm encountering is being able to have both HTTP and HTTPS listeners
in CXF (different ports of coarse).

I tried having an engine-factory setting for each and ever port, then I
tried having just one engine-factory setting using the TLS Server Parameter
Ref.  Neither worked - in fact neither worked even if I had HTTPS configured
for ALL CXF ports - it would always fail if I configured the first port
HTTPS and any subsiquent port HTTPS.  All is good if the first occurance is
HTTPS and subsiquents are all HTTP.

The error is on the first occurance in a mixed set and is:

{code}
org.apache.camel.RuntimeCamelException: java.lang.RuntimeException: Protocol
mismatch for port 9002: engine's protocol is http, the url protocol is https
{code}

my configuration is:

Glassfish 3.1.2
Camel 2.10.2

{code}
	<httpj:engine-factory bus="cxf">
		<httpj:identifiedTLSServerParameters id="cxfTLSconfig">
			<httpj:tlsServerParameters>
				<sec:keyManagers keyPassword="${nextgate.ms.sec.privatekey.password}">
					<sec:keyStore type="JKS"
password="${nextgate.ms.sec.keystore.password}"
file="${nextgate.ms.sec.keystore.file}" />
				</sec:keyManagers>
				
				<sec:trustManagers>
					<sec:keyStore type="JKS"
password="${nextgate.ms.sec.truststore.password}"
file="${nextgate.ms.sec.truststore.file}" />
				</sec:trustManagers>
				
				<sec:cipherSuitesFilter>
					<sec:include>.*_EXPORT_.*</sec:include>
					<sec:include>.*_EXPORT1024_.*</sec:include>
					<sec:include>.*_WITH_DES_.*</sec:include>
					<sec:include>.*_WITH_NULL_.*</sec:include>
					<sec:exclude>.*_DH_anon_.*</sec:exclude>
				</sec:cipherSuitesFilter>
				
				<sec:clientAuthentication want="false" required="false" />
				
			</httpj:tlsServerParameters>
		</httpj:identifiedTLSServerParameters>
		
		<httpj:engine port="${nextgate.ms.hl7v3.pdq.listenport}">
			<httpj:tlsServerParametersRef id="cxfTLSconfig"/>
			<httpj:sessionSupport>true</httpj:sessionSupport>
		</httpj:engine>

		<httpj:engine port="${nextgate.ms.hl7v3.pix.listenport}">
			<httpj:tlsServerParametersRef id="cxfTLSconfig"/>
			<httpj:sessionSupport>true</httpj:sessionSupport>
		</httpj:engine>

		<httpj:engine port="${nextgate.ms.hl7v3.xcpd.listenport}">
			<httpj:tlsServerParametersRef id="cxfTLSconfig"/>
			<httpj:sessionSupport>true</httpj:sessionSupport>
		</httpj:engine>
		
	</httpj:engine-factory>

	<cxf:cxfEndpoint	id="pdqSupplierEndpoint"
					
address="https://${nextgate.ms.hl7v3.pdq.listenaddr}:${nextgate.ms.hl7v3.pdq.listenport}/services/PDQSupplier"
						serviceClass="ihe.iti.pdqv3._2007.PDQSupplierPortType">
		
		<cxf:binding>
			<soap:soapBinding mtomEnabled="true" version="1.2" />
		</cxf:binding>

	</cxf:cxfEndpoint>

	<cxf:cxfEndpoint	id="pixManagerEndpoint"
						endpointName="pixManagerEndpoint"
						bus="cxf"
					
address="https://${nextgate.ms.hl7v3.pix.listenaddr}:${nextgate.ms.hl7v3.pix.listenport}/services/PIXManager"
						serviceClass="ihe.iti.pixv3._2007.PIXManagerPortType">
		
		<cxf:binding>
			<soap:soapBinding mtomEnabled="true" version="1.2" />
		</cxf:binding>

	</cxf:cxfEndpoint>

	<cxf:cxfEndpoint	id="xcpdRespondingGatewayEndpoint"
					
address="https://${nextgate.ms.hl7v3.xcpd.listenaddr}:${nextgate.ms.hl7v3.xcpd.listenport}/services/RespondingGateway"
						serviceClass="ihe.iti.xcpd._2009.RespondingGatewayPortType">
		
		<cxf:binding>
			<soap:soapBinding mtomEnabled="true" version="1.2" />
		</cxf:binding>

	</cxf:cxfEndpoint>

{code}

any clues would be greatly appreciated!!!

thanks!



--
View this message in context: http://camel.465427.n5.nabble.com/Mixed-HTTP-and-HTTPS-Listeners-Using-CXF-tp5722606.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Mixed HTTP and HTTPS Listeners Using CXF

Posted by Willem jiang <wi...@gmail.com>.
As the jetty engine is configured through the port, you can define a bunch of engine inside on engine-factory.
CXF bus will look up the jetty engine factory for you and setup the jetty connector with the setting you configured.


-- 
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang 
Weibo: willemjiang




On Tuesday, November 13, 2012 at 12:44 AM, peter.berkman wrote:

> I got it to work. I put different engine-factories on each port with
> DIFFERENT engine-factory id's and the same "cxf" bus name. It seems that
> this "id" should really be on the engine instead of the factory - no?
> 
> anyway, it does seem to work - if you want just "http", simply do NOT
> declare an engine-factory for it. here is the code for http, https, https:
> 
> {code}
> 
> <http:destination name="pdqSupplierEndpoint">
> </http:destination>
> 
> <cxf:cxfEndpoint id="pdqSupplierEndpoint" 
> 
> address="http://${nextgate.ms.hl7v3.pdq.listenaddr}:${nextgate.ms.hl7v3.pdq.listenport}/services/PDQSupplier"
> serviceClass="ihe.iti.pdqv3._2007.PDQSupplierPortType">
> 
> <cxf:binding>
> <soap:soapBinding mtomEnabled="true" version="1.2" />
> </cxf:binding>
> 
> </cxf:cxfEndpoint>
> 
> <httpj:engine-factory id="efpixManager" bus="cxf">
> <httpj:engine port="${nextgate.ms.hl7v3.pix.listenport}">
> <httpj:tlsServerParameters>
> <sec:keyManagers keyPassword="${nextgate.ms.sec.privatekey.password}">
> <sec:keyStore type="JKS"
> password="${nextgate.ms.sec.keystore.password}"
> file="${nextgate.ms.sec.keystore.file}" />
> </sec:keyManagers>
> 
> <sec:trustManagers>
> <sec:keyStore type="JKS"
> password="${nextgate.ms.sec.truststore.password}"
> file="${nextgate.ms.sec.truststore.file}" />
> </sec:trustManagers>
> 
> <sec:cipherSuitesFilter>
> <sec:include>.*_EXPORT_.*</sec:include>
> <sec:include>.*_EXPORT1024_.*</sec:include>
> <sec:include>.*_WITH_DES_.*</sec:include>
> <sec:include>.*_WITH_NULL_.*</sec:include>
> <sec:exclude>.*_DH_anon_.*</sec:exclude>
> </sec:cipherSuitesFilter>
> 
> <sec:clientAuthentication want="false" required="false" />
> </httpj:tlsServerParameters>
> <httpj:sessionSupport>true</httpj:sessionSupport>
> </httpj:engine>
> </httpj:engine-factory>
> 
> <cxf:cxfEndpoint id="pixManagerEndpoint"
> 
> address="https://${nextgate.ms.hl7v3.pix.listenaddr}:${nextgate.ms.hl7v3.pix.listenport}/services/PIXManager"
> serviceClass="ihe.iti.pixv3._2007.PIXManagerPortType">
> 
> <cxf:binding>
> <soap:soapBinding mtomEnabled="true" version="1.2" />
> </cxf:binding>
> 
> </cxf:cxfEndpoint>
> 
> <httpj:engine-factory id="efxcpdManager" bus="cxf">
> <httpj:engine port="${nextgate.ms.hl7v3.xcpd.listenport}">
> <httpj:tlsServerParameters>
> <sec:keyManagers keyPassword="${nextgate.ms.sec.privatekey.password}">
> <sec:keyStore type="JKS"
> password="${nextgate.ms.sec.keystore.password}"
> file="${nextgate.ms.sec.keystore.file}" />
> </sec:keyManagers>
> 
> <sec:trustManagers>
> <sec:keyStore type="JKS"
> password="${nextgate.ms.sec.truststore.password}"
> file="${nextgate.ms.sec.truststore.file}" />
> </sec:trustManagers>
> 
> <sec:cipherSuitesFilter>
> <sec:include>.*_EXPORT_.*</sec:include>
> <sec:include>.*_EXPORT1024_.*</sec:include>
> <sec:include>.*_WITH_DES_.*</sec:include>
> <sec:include>.*_WITH_NULL_.*</sec:include>
> <sec:exclude>.*_DH_anon_.*</sec:exclude>
> </sec:cipherSuitesFilter>
> 
> <sec:clientAuthentication want="false" required="false" />
> </httpj:tlsServerParameters>
> <httpj:sessionSupport>true</httpj:sessionSupport>
> </httpj:engine>
> </httpj:engine-factory>
> 
> 
> <cxf:cxfEndpoint id="xcpdRespondingGatewayEndpoint"
> 
> address="https://${nextgate.ms.hl7v3.xcpd.listenaddr}:${nextgate.ms.hl7v3.xcpd.listenport}/services/RespondingGateway"
> serviceClass="ihe.iti.xcpd._2009.RespondingGatewayPortType">
> 
> <cxf:binding>
> <soap:soapBinding mtomEnabled="true" version="1.2" />
> </cxf:binding>
> 
> <cxf:inInterceptors>
> <ref bean="loggingInInterceptor" />
> <ref bean="mustUnderstandSAMLHeadersInterceptor" />
> </cxf:inInterceptors>
> 
> <cxf:outInterceptors>
> <ref bean="samlAssertionInterceptor" />
> <ref bean="loggingOutInterceptor" />
> 
> </cxf:outInterceptors>
> 
> </cxf:cxfEndpoint>
> 
> {code}
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Mixed-HTTP-and-HTTPS-Listeners-Using-CXF-tp5722606p5722612.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).




Re: Mixed HTTP and HTTPS Listeners Using CXF

Posted by "peter.berkman" <pe...@cornergrove.com>.
I got it to work.  I put different engine-factories on each port with
DIFFERENT engine-factory id's and the same "cxf" bus name.   It seems that
this "id" should really be on the engine instead of the factory - no?

anyway, it does seem to work - if you want just "http", simply do NOT
declare an engine-factory for it.  here is the code for http, https, https:

{code}

	<http:destination name="pdqSupplierEndpoint">
	</http:destination>
	
	<cxf:cxfEndpoint	id="pdqSupplierEndpoint"   
					
address="http://${nextgate.ms.hl7v3.pdq.listenaddr}:${nextgate.ms.hl7v3.pdq.listenport}/services/PDQSupplier"
						serviceClass="ihe.iti.pdqv3._2007.PDQSupplierPortType">
		
		<cxf:binding>
			<soap:soapBinding mtomEnabled="true" version="1.2" />
		</cxf:binding>

	</cxf:cxfEndpoint>

	<httpj:engine-factory id="efpixManager" bus="cxf">
		<httpj:engine port="${nextgate.ms.hl7v3.pix.listenport}">
			<httpj:tlsServerParameters>
				<sec:keyManagers keyPassword="${nextgate.ms.sec.privatekey.password}">
					<sec:keyStore type="JKS"
password="${nextgate.ms.sec.keystore.password}"
file="${nextgate.ms.sec.keystore.file}" />
				</sec:keyManagers>
				
				<sec:trustManagers>
					<sec:keyStore type="JKS"
password="${nextgate.ms.sec.truststore.password}"
file="${nextgate.ms.sec.truststore.file}" />
				</sec:trustManagers>
				
				<sec:cipherSuitesFilter>
					<sec:include>.*_EXPORT_.*</sec:include>
					<sec:include>.*_EXPORT1024_.*</sec:include>
					<sec:include>.*_WITH_DES_.*</sec:include>
					<sec:include>.*_WITH_NULL_.*</sec:include>
					<sec:exclude>.*_DH_anon_.*</sec:exclude>
				</sec:cipherSuitesFilter>
				
				<sec:clientAuthentication want="false" required="false" />
			</httpj:tlsServerParameters>
			<httpj:sessionSupport>true</httpj:sessionSupport>
		</httpj:engine>
	</httpj:engine-factory>

	<cxf:cxfEndpoint	id="pixManagerEndpoint"
					
address="https://${nextgate.ms.hl7v3.pix.listenaddr}:${nextgate.ms.hl7v3.pix.listenport}/services/PIXManager"
						serviceClass="ihe.iti.pixv3._2007.PIXManagerPortType">
		
		<cxf:binding>
			<soap:soapBinding mtomEnabled="true" version="1.2" />
		</cxf:binding>

	</cxf:cxfEndpoint>

	<httpj:engine-factory id="efxcpdManager" bus="cxf">
		<httpj:engine port="${nextgate.ms.hl7v3.xcpd.listenport}">
			<httpj:tlsServerParameters>
				<sec:keyManagers keyPassword="${nextgate.ms.sec.privatekey.password}">
					<sec:keyStore type="JKS"
password="${nextgate.ms.sec.keystore.password}"
file="${nextgate.ms.sec.keystore.file}" />
				</sec:keyManagers>
				
				<sec:trustManagers>
					<sec:keyStore type="JKS"
password="${nextgate.ms.sec.truststore.password}"
file="${nextgate.ms.sec.truststore.file}" />
				</sec:trustManagers>
				
				<sec:cipherSuitesFilter>
					<sec:include>.*_EXPORT_.*</sec:include>
					<sec:include>.*_EXPORT1024_.*</sec:include>
					<sec:include>.*_WITH_DES_.*</sec:include>
					<sec:include>.*_WITH_NULL_.*</sec:include>
					<sec:exclude>.*_DH_anon_.*</sec:exclude>
				</sec:cipherSuitesFilter>
				
				<sec:clientAuthentication want="false" required="false" />
			</httpj:tlsServerParameters>
			<httpj:sessionSupport>true</httpj:sessionSupport>
		</httpj:engine>
	</httpj:engine-factory>


	<cxf:cxfEndpoint	id="xcpdRespondingGatewayEndpoint"
					
address="https://${nextgate.ms.hl7v3.xcpd.listenaddr}:${nextgate.ms.hl7v3.xcpd.listenport}/services/RespondingGateway"
						serviceClass="ihe.iti.xcpd._2009.RespondingGatewayPortType">
		
		<cxf:binding>
			<soap:soapBinding mtomEnabled="true" version="1.2" />
		</cxf:binding>

        <cxf:inInterceptors>
			<ref bean="loggingInInterceptor" />
			<ref bean="mustUnderstandSAMLHeadersInterceptor" />
		</cxf:inInterceptors>

		<cxf:outInterceptors>
			<ref bean="samlAssertionInterceptor" />
			<ref bean="loggingOutInterceptor" />
			
		</cxf:outInterceptors>

	</cxf:cxfEndpoint>

{code}



--
View this message in context: http://camel.465427.n5.nabble.com/Mixed-HTTP-and-HTTPS-Listeners-Using-CXF-tp5722606p5722612.html
Sent from the Camel - Users mailing list archive at Nabble.com.