PDA

View Full Version : How to integrate Spring-WS with existing web-app?


lasse_stromberg
Jun 28th, 2006, 05:59 AM
Hi,

I have an existing web-app based on Spring MVC. Now i want to expose some of its functionality with Spring-WS as webservice.
But i'm not sure how to configure my context properly. At the moment i use the same Dispatcher servlet for my web-app and Spring-WS.
Then i have a single SimpleUrlHandlerMapping that maps both the requests to my web-app controllers and to the SoapMessageDispatcher of Spring-WS.
The soap part is running fine now even with Acegi integration using Basic Authentication. But after inserting the config for MessageHandlerAdapter into
my application-servlet.xml the web application stops working and says: No adapter for handler [StartPageController@60e78]: Does your handler implement a supported interface like Controller?
I did not change anything related to my web app config just the addition of the MessageHandlerAdapter crashes my config.
What is the best way to configure Spring-WS together with a web-app? Is it a configuration error or have i missed something?

Thanks in advance and special thx to Arjen: you did a very good job so far!

Arjen Poutsma
Jun 28th, 2006, 06:56 AM
I have an existing web-app based on Spring MVC. Now i want to expose some of its functionality with Spring-WS as webservice.
But i'm not sure how to configure my context properly. At the moment i use the same Dispatcher servlet for my web-app and Spring-WS.
Then i have a single SimpleUrlHandlerMapping that maps both the requests to my web-app controllers and to the SoapMessageDispatcher of Spring-WS.
The soap part is running fine now even with Acegi integration using Basic Authentication. But after inserting the config for MessageHandlerAdapter into
my application-servlet.xml the web application stops working and says: No adapter for handler [StartPageController@60e78]: Does your handler implement a supported interface like Controller?
I did not change anything related to my web app config just the addition of the MessageHandlerAdapter crashes my config.
What is the best way to configure Spring-WS together with a web-app? Is it a configuration error or have i missed something?


That's one of the lesser known features of the DispatcherServlet: if you provide a custom HandlerAdapter (such as the MessageHandlerAdapter), you will lose the standard ones (which are listed in DispatcherServlet.properties). So the solution is to add the SimpleControllerHandlerAdapter to the application-servlet.xml,and everything should work again.

Thanks in advance and special thx to Arjen: you did a very good job so far!

Thanks!

lasse_stromberg
Jun 28th, 2006, 07:43 AM
Hi Arjen!

thx for your quick help! After adding the line:
<bean id="controllerHandlerAdapter" class="org.springframework.web.servlet.mvc.SimpleControll erHandlerAdapter"/>
to my application-servlet-xml everything works fine!