I'm working SOAP and REST together into the same application. Rest web service with @RestController and SOAP with apache cxf. Rest ws and soap have the same path, for example: Rest: GET http://localhost:8080/ws/person SOAP: http://localhost:8080/ws/findPerson
For configuring cxf servlet, i create the following method
@Bean
public ServletRegistrationBean cxfServletRegistration() {
return new ServletRegistrationBean(new CXFServlet(), "/ws/*"); }
SOAP Service are running fine after change but REST (@RestController) stop working, but if I disable the method cxfServletRegistration(), the rest WS working fine.
Could you suggest any solution to make all WS working together ?
You can't, because each servlet must "own" its listening basepath. Despite the lack of an explicit registration, RestControllers listen on a base path (default /*) Do you actually need to use @RestController? CXF has REST support via JAX-RS.
Otherwise, I would suggest to separate your REST and SOAP functionality, such as having REST on /model/... and SOAP on /api/... or some such separation.