2
votes

I am trying to learn some basics of Apache CXF and generally about servlet-mappings. and I have modified the code here:

https://subversion.assembla.com/svn/pablo-examples/spring-cxf-example

I have configured CXFServlet mapping as below in web.xml

<servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
</servlet-mapping>

in the spring xml(webservice-definition-beans.xml) I have generated the service as below

<jaxws:endpoint id="helloWorld" implementor="#helloWorldService" address="/services/HelloWorld" />

I was expecting to access to the service wsdl via this url

http://localhost:8080/services/HelloWorld?wsdl

but it is

http://localhost:8080/services/services/HelloWorld?wsdl

Do I know something wrong here ?

Does not servlet-mapping only show which url pattern maps to which servlet to process ?

In here It seems it also changes context.

1

1 Answers

6
votes

The JAX-WS path is relative to servlet mapping. If you want

http://localhost:8080/services/HelloWorld?wsdl

use either

<servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/*</url-pattern>
</servlet-mapping>

<jaxws:endpoint id="helloWorld" implementor="#helloWorldService" address="/services/HelloWorld" />

or

<servlet-mapping>
    <servlet-name>CXFServlet</servlet-name>
    <url-pattern>/services/*</url-pattern>
</servlet-mapping>

<jaxws:endpoint id="helloWorld" implementor="#helloWorldService" address="/HelloWorld" />