Announcement Announcement Module
Collapse
No announcement yet.
New feature: MessageDispatcherServlet Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • New feature: MessageDispatcherServlet

    Hi,

    I've just implemented a new feature for Spring-WS, which makes its usage more convenient. In the past, it was necessary to define a DispatcherServlet, a MessageEndpointHandlerAdapter, and a MessageDispatcher seperately for each Spring-WS project. The idea behind this is that the MessageDispatcher is completely agnostic of the ins and outs of HTTP, since it is just a form of transport.

    However, most people want to expose their Web services using HTTP (they are called Web services for a reason), so I added a convience class called MessageDispatcherServlet which combines the DispatcherServlet and MessageDispatcher into one. All defined EndpointMappings, EndpointAdapters, and EndpointExceptionResolvers defined in the servlet application context are automatically detected, so there is no more need to define a MessageDispatcher seperately. All in all, a lot less XML to type!

    Look in the echo sample how it is used. Note that the MessageDispatcherServlet doesn't do the automatic "location" translation" of WSDLs (yet). I'm not sure if I want this behavior in, if you do, please leave a comment (or better yet, create an improvement JIRA issue).

  • #2
    Originally posted by Arjen Poutsma View Post
    Hi,

    I've just implemented a new feature for Spring-WS, which makes its usage more convenient. In the past, it was necessary to define a DispatcherServlet, a MessageEndpointHandlerAdapter, and a MessageDispatcher seperately for each Spring-WS project. The idea behind this is that the MessageDispatcher is completely agnostic of the ins and outs of HTTP, since it is just a form of transport.

    However, most people want to expose their Web services using HTTP (they are called Web services for a reason), so I added a convience class called MessageDispatcherServlet
    Can this be configured to use a service layer context as follows:
    Code:
    <context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>/WEB-INF/applicationContext.xml</param-value>
    	</context-param>
    	<context-param>
    		<param-name>locatorFactorySelector</param-name>
    		<param-value>net/blabla/spring/beanRefContext.xml</param-value>
    	</context-param>
    	<context-param>
    		<param-name>parentContextKey</param-name>
    		<param-value>servicelayer-context</param-value>
    	</context-param>
    	<listener>
    		<listener-class>
    			org.springframework.web.context.ContextLoaderListener
    		</listener-class>
    	</listener>

    Comment


    • #3
      second web service app does not recognize parentContextKey

      I have created 2 web service apps using MessageDispatcherServlet and both want to use an underlying stateful service layer. I crete and load this layer via
      "parentContextKey". The problem is that the first web app that loads works perfectly the second does not. It seems that the secons app cannot find the "parentContextKey" for some reason. If I remove the first wen app and then just run the second it works just fine.

      Anyone have any ideas on how to solve this one.

      Here is my web.xml
      <context-param>
      <param-name>parentContextKey</param-name>
      <param-value>services.context</param-value>
      </context-param>

      <listener>
      <listener-class>
      org.springframework.web.context.ContextLoaderListe ner
      </listener-class>
      </listener>

      <!-- Defines the Spring-WS MessageDispatcherServlet -->
      <servlet>
      <servlet-name>spring-ws</servlet-name>
      <servlet-class>
      org.springframework.ws.transport.http.MessageDispa tcherServlet
      </servlet-class>
      <init-param>
      <!-- Transform the location attributes in WSDLs -->
      <param-name>transformWsdlLocations</param-name>
      <param-value>true</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
      </servlet>

      <!-- Map all requests to this servlet -->
      <servlet-mapping>
      <servlet-name>spring-ws</servlet-name>
      <url-pattern>/*</url-pattern>
      </servlet-mapping>

      Comment

      Working...
      X