Spring has a simplifed way of declaring web services (wiht cxf).
in your applicationContext.xml
add xmlns:jaxws="http://cxf.apache.org/jaxws"
to your root tag (<beans>
) and
http://cxf.apache.org/core
http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
to your schemaLocation
Then add:
<!-- Loading CXF modules -->
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
And finally declare your WebService implementation:
<jaxws:endpoint id="MyWebService" implementor="#MyWebServiceImpl"
address="/myWebServiceAddress" />
where #MyWebServiceImpl
is the ID of your bean. You can freely inject any other spring dependencies into that bean.
Then the web service will be accessible through http://yourhost/cxfuri/myWebServiceAddress
(where cxfuri is the mapping of your CXF Servlet)