You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Ch...@t-systems.com on 2009/12/09 13:31:48 UTC
How to use CXFServlet and embedded Jetty in one application
Hi,
I have a web application that provides a web service running on a
Tomcat.
While executing a service request the application calls other web
services asynchronously, providing a callback service on an embedded
Jetty.
As far as I understand, I can't include both the cxf-servlet.xml (for
the CXFServlet in Tomcat) and cxf-extension-http-jetty.xml (for the
callback service in Jetty) in my Spring configuration.
How is it possible to make it work anyway?
Thanks in advance,
Christian
RE: How to use CXFServlet and embedded Jetty in one application
Posted by Ch...@t-systems.com.
Thanks a lot, now it works like this: The service provided by the
CXFServlet in Tomcat is configured via Spring application context,
and the callback service is created by JaxWsServerFactoryBean.
----- myService.xml -----
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import
resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml" />
<import
resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<jaxws:endpoint id="myServiceEndpoint"
implementorClass="MyServiceInterface"
implementor="#myServiceImpl"
address="/myService"/>
----- myService.xml -----
----- cxf-bus.xml -----
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import
resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml" />
<import
resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
<import
resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
----- cxf-bus.xml -----
----- java snippet -----
Bus bus = new SpringBusFactory().createBus("cxf-bus.xml");
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setBus(bus);
factory.setServiceClass(CallbackInterface.class);
factory.setServiceBean(callbackImpl);
factory.setAddress(callbackUrl);
Server server = factory.create();
----- java snippet -----
Thanks again,
Christian
-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org]
Sent: Wednesday, December 09, 2009 4:54 PM
I think the only way to accomplish this is to have a separate Bus for
the
client. In your web service impl, you would do something like:
Bus orig = BusFactory.getThreadDefaultBus();
Bus bus = SpringBusFactory.createBus(... client config file ...);
BusFactory.setThreadDefaultBus(bus);
... create and use your client .....
BusFactory.setThreadDefaultBus(orig);
The Bus for the client could be held onto as a variable or similar to
avoid
recreating each time.
Dan
On Wed December 9 2009 7:31:48 am Christian.Priebe@t-systems.com wrote:
> Hi,
>
> I have a web application that provides a web service running on a
> Tomcat.
> While executing a service request the application calls other web
> services asynchronously, providing a callback service on an embedded
> Jetty.
>
> As far as I understand, I can't include both the cxf-servlet.xml (for
> the CXFServlet in Tomcat) and cxf-extension-http-jetty.xml (for the
> callback service in Jetty) in my Spring configuration.
>
> How is it possible to make it work anyway?
>
> Thanks in advance,
>
> Christian
>
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Re: How to use CXFServlet and embedded Jetty in one application
Posted by Daniel Kulp <dk...@apache.org>.
I think the only way to accomplish this is to have a separate Bus for the
client. In your web service impl, you would do something like:
Bus orig = BusFactory.getThreadDefaultBus();
Bus bus = SpringBusFactory.createBus(... client config file ...);
BusFactory.setThreadDefaultBus(bus);
... create and use your client .....
BusFactory.setThreadDefaultBus(orig);
The Bus for the client could be held onto as a variable or similar to avoid
recreating each time.
Dan
On Wed December 9 2009 7:31:48 am Christian.Priebe@t-systems.com wrote:
> Hi,
>
> I have a web application that provides a web service running on a
> Tomcat.
> While executing a service request the application calls other web
> services asynchronously, providing a callback service on an embedded
> Jetty.
>
> As far as I understand, I can't include both the cxf-servlet.xml (for
> the CXFServlet in Tomcat) and cxf-extension-http-jetty.xml (for the
> callback service in Jetty) in my Spring configuration.
>
> How is it possible to make it work anyway?
>
> Thanks in advance,
>
> Christian
>
--
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
RE: How to use CXFServlet and embedded Jetty in one application
Posted by Ch...@t-systems.com.
The application exists as described and is being migrated from
Axis to CXF now. I did't want to change the whole architecture.
If I run them in separate JVMs or application contexts, there
is the hassle of wiring them together.
Ain't there a way to do this in one application, even if it has
to be done programmatically?
Regards,
Christian
-----Original Message-----
Two configuration. Put everything you need for your web services into
a webapp, spring config and all.
Then use a separate app context to set up and launch embedded jetty.
On Wed, Dec 9, 2009 at 8:24 AM, Glen Mazza <gl...@gmail.com> wrote:
>
> Probably a better answer around, but some possibilities:
>
> 1.) Use an embedded Tomcat instance:
> http://www.jroller.com/gmazza/entry/writing_junit_test_cases_for (Step
#3)
> 2.) Have the embedded Jetty instance run in a separate JVM, separate
> application with Jetty-specific configuration (basically, make it
> standalone).
>
> HTH,
> Glen
>
>
> Christian.Priebe wrote:
>>
>> Hi,
>>
>> I have a web application that provides a web service running on a
>> Tomcat.
>> While executing a service request the application calls other web
>> services asynchronously, providing a callback service on an embedded
>> Jetty.
>>
>> As far as I understand, I can't include both the cxf-servlet.xml (for
>> the CXFServlet in Tomcat) and cxf-extension-http-jetty.xml (for the
>> callback service in Jetty) in my Spring configuration.
>>
>> How is it possible to make it work anyway?
>>
>> Thanks in advance,
>>
>> Christian
>>
>>
>
> --
> View this message in context:
http://old.nabble.com/How-to-use-CXFServlet-and-embedded-Jetty-in-one-ap
plication-tp26709470p26710089.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>
Re: How to use CXFServlet and embedded Jetty in one application
Posted by Benson Margulies <bi...@gmail.com>.
Two configuration. Put everything you need for your web services into
a webapp, spring config and all.
Then use a separate app context to set up and launch embedded jetty.
On Wed, Dec 9, 2009 at 8:24 AM, Glen Mazza <gl...@gmail.com> wrote:
>
> Probably a better answer around, but some possibilities:
>
> 1.) Use an embedded Tomcat instance:
> http://www.jroller.com/gmazza/entry/writing_junit_test_cases_for (Step #3)
> 2.) Have the embedded Jetty instance run in a separate JVM, separate
> application with Jetty-specific configuration (basically, make it
> standalone).
>
> HTH,
> Glen
>
>
> Christian.Priebe wrote:
>>
>> Hi,
>>
>> I have a web application that provides a web service running on a
>> Tomcat.
>> While executing a service request the application calls other web
>> services asynchronously, providing a callback service on an embedded
>> Jetty.
>>
>> As far as I understand, I can't include both the cxf-servlet.xml (for
>> the CXFServlet in Tomcat) and cxf-extension-http-jetty.xml (for the
>> callback service in Jetty) in my Spring configuration.
>>
>> How is it possible to make it work anyway?
>>
>> Thanks in advance,
>>
>> Christian
>>
>>
>
> --
> View this message in context: http://old.nabble.com/How-to-use-CXFServlet-and-embedded-Jetty-in-one-application-tp26709470p26710089.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>
Re: How to use CXFServlet and embedded Jetty in one application
Posted by Glen Mazza <gl...@gmail.com>.
Probably a better answer around, but some possibilities:
1.) Use an embedded Tomcat instance:
http://www.jroller.com/gmazza/entry/writing_junit_test_cases_for (Step #3)
2.) Have the embedded Jetty instance run in a separate JVM, separate
application with Jetty-specific configuration (basically, make it
standalone).
HTH,
Glen
Christian.Priebe wrote:
>
> Hi,
>
> I have a web application that provides a web service running on a
> Tomcat.
> While executing a service request the application calls other web
> services asynchronously, providing a callback service on an embedded
> Jetty.
>
> As far as I understand, I can't include both the cxf-servlet.xml (for
> the CXFServlet in Tomcat) and cxf-extension-http-jetty.xml (for the
> callback service in Jetty) in my Spring configuration.
>
> How is it possible to make it work anyway?
>
> Thanks in advance,
>
> Christian
>
>
--
View this message in context: http://old.nabble.com/How-to-use-CXFServlet-and-embedded-Jetty-in-one-application-tp26709470p26710089.html
Sent from the cxf-user mailing list archive at Nabble.com.