You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ychawla <pr...@gmail.com> on 2015/01/30 18:17:31 UTC

Re: Problem with multiple CXF services using the same https port

Hi Christian,
Can you provide an example of how to set this up?  The situation I have is
this, which I think is the exact same as you describe.

I have a central broker server on it with many different bundles:

bundle A
bundle B
bundle C

Each bundle hosts a web service with a distinct WSDL and schema.  Rather
than host each bundle on a different port which creates a firewall
nightmare, we want to set up a single port and host all service on it.

I updated my pax config file like this:

org.osgi.service.http.secure.enabled=true
org.ops4j.pax.web.ssl.keystore=etc/my-keystore.jks
org.ops4j.pax.web.ssl.password=my-keystore
org.ops4j.pax.web.ssl.keypassword=my-key
org.osgi.service.http.port.secure=8443
org.ops4j.pax.web.config.file=etc/jetty.xml
org.osgi.service.http.port=8181
javax.servlet.context.tempdir=data/pax-web-jsp

I installed the 'http' feature in ServiceMix and can see this page in a
browser served up by Jetty:

https://localhost:8443/

In my camel bundle, I set up a CXF endpoint with a URL like this:

https://localhost:8443/MyService

However, I can not start up my service in a simple Camel Context in a unit
test and I get an error like this:

java.lang.IllegalStateException: Port 8443 is configured with wrong protocol
"http" for "https://localhost:8443/MyService"

My understanding is that I should set up my CXF endpoint as usual and then
remove the embedded Jetty instance.   That way the bundle doesn't attempt to
start a standalone instance of Jetty.  Originally in standalone mode i used
a bean like this:

	<httpj:engine-factory id="MyHttpsSettings"
		bus="cxf">

Any ideas of how I can set up multiple bundles in the same SMX instance that
use different WSDLs / schemas on the same port?

Thanks!
Yogesh



--
View this message in context: http://camel.465427.n5.nabble.com/Problem-with-multiple-CXF-services-using-the-same-https-port-tp3379301p5762264.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problem with multiple CXF services using the same https port

Posted by ychawla <pr...@gmail.com>.
Hello all,
I got a little further with my configuration and think I got it working.  I
looked at the camel-example-cxf-osgi and it looks like all you really have
to do is remove the standalone jetty HTTP(s) listener and then provide your
address as a relative path in your Camel CXF bean.  Just remove the protocol
and host.

Here are a few observations.  It seems like you need to have a Jetty bean
set up to perform unit tests or have a ServiceMix instance running with the
jetty port running.  The jetty bean looks like:

	<httpj:engine-factory id="httpsSettings"
		bus="cxf">
		<httpj:engine port="8888">
			<httpj:tlsServerParameters>
				<sec:keyManagers keyPassword="password">
					<sec:keyStore type="jks" password="password" file="keystore.jks" />
				</sec:keyManagers>
				<sec:cipherSuitesFilter>
					    <sec:include>TLS_DHE_RSA_WITH_AES_128_CBC_SHA</sec:include>
					    <sec:include>SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA</sec:include>
					    <sec:include>TLS_RSA_WITH_AES_128_CBC_SHA</sec:include>
					    <sec:include>SSL_RSA_WITH_3DES_EDE_CBC_SHA</sec:include>
				</sec:cipherSuitesFilter>
				<sec:clientAuthentication want="false"
					required="false" />
			</httpj:tlsServerParameters>
		</httpj:engine>
	</httpj:engine-factory> 

You can include this jetty bean under src/test/resources as your build
process allows.

It also appears as if all urls require 'cxf' in the path.  For the camel
example, the URL is:

http://localhost:8181/cxf/camel-example-cxf-osgi/webservices/incident?wsdl

There is a reference in the documentation to editing this so you can set
your own property:

Changing /cxf servlet alias
---------------------------
By default CXF Servlet is assigned a '/cxf' alias. You can
change it in a couple of ways

a. Add org.apache.cxf.osgi.cfg to the /etc directory and set
   the 'org.apache.cxf.servlet.context' property, for example:
   
     org.apache.cxf.servlet.context=/custom
   
b. Use shell config commands, for example :
   
     config:edit org.apache.cxf.osgi   
     config:propset org.apache.cxf.servlet.context /super
     config:update

To remove 'http' and only provide a secure port, comment out this line:

#org.osgi.service.http.port=8181

Hopefully this is helpful to someone who visits this thread later.

Thanks!
Yogesh





--
View this message in context: http://camel.465427.n5.nabble.com/Problem-with-multiple-CXF-services-using-the-same-https-port-tp3379301p5762271.html
Sent from the Camel - Users mailing list archive at Nabble.com.