首页 > 其他分享 >Supporting Spring-WS and Spring MVC integration in a project

Supporting Spring-WS and Spring MVC integration in a project

时间:2023-06-04 15:32:14浏览次数:34  
标签:Supporting web Spring integration MVC ws spring WS


[url]http://www.java-allandsundry.com/2011/06/supporting-spring-ws-and-spring-mvc.html[/url]
Spring WS and Spring MVC provide different front controller implementations as a gateway to the webservice and the MVC functionality respectively. The Dispatcher Servlet used by Spring-WS is :

view sourceprint?

org.springframework.ws.transport.http.MessageDispatcherServlet


and the one used by Spring MVC is :


view sourceprint?


org.springframework.web.servlet.DispatcherServlet


To have a combined Spring MVC and Spring-WS project, it is possible to configure these front controllers based on the URI pattern of the request, in the following way:


view sourceprint?


<servlet>
        <servlet-name>member-ws</servlet-name>
        <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
        <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:/META-INF/spring/applicationContext-ws.xml</param-value>
        </init-param>
    </servlet>

    <servlet>
        <servlet-name>member-web</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/spring/webmvc-config.xml</param-value>
        </init-param>
    </servlet>    

    <servlet-mapping>
        <servlet-name>member-ws</servlet-name>
        <url-pattern>/services/*</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>member-ws</servlet-name>
        <url-pattern>*.wsdl</url-pattern>
    </servlet-mapping>

    <servlet-mapping>
        <servlet-name>member-web</servlet-name>
        <url-pattern>/web/*</url-pattern>
    </servlet-mapping>





In this specific instance, all requests to /web/ is handled by the Spring MVC DispatcherServlet whereas all requests to /services is handled by Spring-WS DispatcherServlet. Further, each dispatcher servlet is configured with its custom Spring configuration file, the one for Spring MVC loads up the contollers, the one for Spring WS loads up the Webservice endpoints.



I am not sure if this is a optimal configuration, but it works for me in this project available at: git://github.com/bijukunjummen/memberservice-contractfirst.git




OR An alternate way to hook up DispatcherServlet to handle Spring-WS requests is described here!: http://static.springsource.org/spring-ws/sites/2.0/reference/html/server.html#d4e884


标签:Supporting,web,Spring,integration,MVC,ws,spring,WS
From: https://blog.51cto.com/u_3871599/6410795

相关文章

  • Spring CXF实例
    [b][color=red]参考:[/color][/b]CXFSpring整合——又一个helloword![url]http://pphqq.iteye.com/blog/1447800[/url]一个依赖问题:A:[color=red]如果希望以一种一致的方式实现webservice,特别是有跨语言的需求时,应该使用[b]Axis2[/b][/color]B:[color......
  • Spring和MyBatis整合
    框架整合时三层架构的分工  进行SSM框架整合时,两个框架的分工如下所示。MyBatis负责与数据库进行交互。Spring负责事务管理,Spring可以管理持久层的Mapper对象及业务层的Service对象。由于Mapper对象和Service对象都在Spring容器中,所以可以在业务逻辑层通过Service对象调用......
  • Spring3.2 + cxf1.7.3整合
    参考:[url]http://tsinglongwu.iteye.com/blog/832704[/url][color=red][b]测试调试工具介绍[/b][/color][b]1.SoapUI1.6[/b][url]http://webservices.ctocio.com.cn/tips/263/7817763.shtml[/url][b]2.TestMaker[/b][url]http://webservices.ctocio.com......
  • SpringMVC3.2.x + Hibernate4.2.x + ecache + Spring Security 3.0.5
    这只是部分代码,一些代码可以参考:[url]http://panyongzheng.iteye.com/blog/1871418[/url]SpringSecurity3.1最新配置实例[url它自带的附件也上传。SpringSecurity3十五日研究[url]http://www.blogjava.net/SpartaYew/archive/2013/09/23/350630.html[/......
  • Spring整合mybatis使用xml配置事务
    自己准备开始教授Java相关的技术,Spring框架是必须让学生学习的框架之一。里面有一个事务的配置以前刚学习Spring框架的时候有接触过,不过已经过了很多年,很多东西都已经忘记。现在再来回忆一下如何使用Spring框架类配置事务。使用到的maven坐标如下:<dependencies>    <......
  • 从日志记一次Spring事务完整流程
    spring事务一次完整流程,创建》确认获取连接》完成》提交》释放链接DataSourceTransactionManager//Step1.进入业务方法前,依据事物切面创建事务对象2019-07-0622:34:24,819[main]DEBUGo.s.j.d.DataSourceTransactionManager-Creatingnewtransactionwithname[com......
  • Spring 3.0.5+MyBatis3.0.4整合非完全例子
    基于注解的mybatis和spring整合:[url]http://huangmin001.iteye.com/blog/1185806[/url][color=red]这个文章说的很详细,很值得一看[/color].Maven+SpringMVC+Mybatis【绝非原创,单纯整理】【四】:[url]http://playgod1984.iteye.com/blog/984113[/ur......
  • spring jdbcTemplate使用
    参考:springjdbcTemplate使用[url]http://log-cd.iteye.com/blog/215059[/url]SpringJdbcTemplate与事务管理学习[url]http://www.iteye.com/topic/480432[/url]SimpleJdbcTemplate在spring3.1已经过时了,我就改为使用jdbcTemplate和namedParameterJdbcOperations写sql查询......
  • SpringSecurity使用JWT
    SpringSecurity的UsernamePasswordAuthenticationFilter用于处理认证。要整合JWT,只需在认证成功后生成TOKEN并通过响应头写回客户端。在新增一个过滤器用于校验TOKEN。新建SpringBoot项目,添加依赖:<dependency><groupId>org.springframework.boot</groupId>......
  • Spring常用注解
    SVN多版本库环境的搭建OAuth2.0是什么?看这篇文章就够了。前端JavaPython等资源合集大放送使用注解之前要开启自动扫描功能,其中base-package为需要扫描的包(含子包)。<context:component-scanbase-package="cn.com.cms"/>@Configuration把一个类作为一个IoC容器,它的某个方法头上......