views:

208

answers:

1

I have set up a CXF web service which works well. My service primarily loads data from an ftp to a db.

I would like to create a web interface through which the invoker can view the progress of their package. I thought it would be easy to integrate Spring MVC with CXF but there doesn't seem to be any good solution. I searched all over the net and could not find any thing simpler than this http://ayax79.wordpress.com/2009/02/19/making-spring-mvc-and-cxf-play-well-together/

The reason I would like to integrate Spring MVC with CXF and not create a stand alone web interface is because I have some custom Spring beans with in the CXF service which I can make use off to start and stop the process.

Is it that difficult to build an interface on CXF? Or am I just not thinking in the right direction?

+1  A: 

The article you linked to has more to do with handling 1) web requests and 2) CXF requests within the same webapp, i.e. building a web application which can accept traditional http requests for MVC pages and also accept web service requests.

The author of that article seems to be pretty confused about Spring and how ApplicationContexts work, as the commenter Felix provides a good and simple solution for what the original author wants to accomplish (reuse the same bean definitions and instances within two contexts, having some URLs mapped to DispatcherServlet and other URLs mapped to a CXF dispatcher).

If you simply want your Spring MVC web application to be able to interact with and make requests to a CXF service, this is simple - you write code to consume the services as you would in any other type of application that interacted with a CXF/Soap/etc web service.

I'd recommend taking a look at the following sections in the Spring manual about access JAXRPC or JAXWS web services:

Another option that you have is to simply generate client proxies for your CXF service using a tool like wsdl2java. Note that the next two options on this page I linked to, "JAX-WS Proxy" and "JAX-WS Dipatch APIs" do the same thing functionally as the Spring option above (creating a dynamic proxy at runtime).

matt b
That makes sense. So you mean, I write new service methods (in cxf) that can be invoked to start or stop a process running in CXF.
Rag
Well I was assuming you already had service methods in your CXF service which you were exposing that you merely want to be able to call from your MVC app - is this not the case?
matt b
No, I don't have any service methods exposed. My thought process was similar to the article I attached i.e. integrating spring MVC and CXF together. Where I could accesses my cxf spring beans in Spring MVC and perform the stop/start through the interface. Hence not requiring to create new service methods in CXF. But from the looks of that article, it doesn't seem to be a straight forward solution?
Rag