Mapping Web Service Requests to Endpoints
In a Spring MVC application, you use handler mapping to map web requests to handlers. But in a
Spring-WS application, you should use endpoint mapping to map web service requests to endpoints.
The most common endpoint mapping is PayloadRootQNameEndpointMapping . It maps web service
requests to endpoints according to the name of the request payload's root element. The name used by
this endpoint mapping is the qualified name (i.e., including the namespace). So you must include the
namespace in the mapping keys, which is presented inside a brace.
Creating Service Endpoints
Spring-WS supports various XML parsing APIs, including DOM, JDOM, dom4j, SAX, StAX, and XOM. As
an example, I will use dom4j ( http://www.dom4j.org ) to create a service endpoint. Creating an endpoint
using other XML parsing APIs is very similar.
You can create a dom4j endpoint by extending the AbstractDom4jPayloadEndpoint class. The core
method defined in this class that you must override is invokeInternal() . In this method, you can access
the request XML element, whose type is org.dom4j.Element , and the response document, whose type is
org.dom4j.Document , as method arguments. The purpose of the response document is for you to create
the response element from it. Now all you have to do in this method is handle the request message and
return the response message.
Note To create a service endpoint using dom4j with XPath, you have to copy dom4j-1.6.1.jar (located in
the lib/dom4j directory of the Spring-WS installation) and jaxen-1.1.1.jar (located in lib/jaxen ) to the