CXF jaxws endpoint of relative publication address

I'm having difficulty trying to use the relative publishing address in my CXF web service endpoint configuration.

I have a simple Java first JAX-WS project with the following configuration files:

applicationContent-cxf.xml:

<beans xmlns=...> ... <jaxws:endpoint id="helloWorldService" implementorClass="org.helloworld.ws.HelloWorldServiceImpl" implementor="#helloWorldServiceImpl" <!-- spring managed --> endpointName="sayHello" address="HelloWorldService"/> </beans> 

web.xml:

 <web-app> <context-param> <param-name>contextConfigLocation</param-name> <param-value> WEB-INF/applicationContext.xml WEB-INF/applicationContext-cxf.xml </param-value> </context-param> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <servlet> <servlet-name>HelloWorldServlet</servlet-name> <display-name>Hello World Servlet</display-name> <servlet-class> org.apache.cxf.transport.servlet.CXFServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>HelloWorldServlet</servlet-name> <url-pattern>/services/*</url-pattern> </servlet-mapping> </web-app> 

According to http://cxf.apache.org/docs/servlet-transport.html it seems that I should specify the HelloWorldService publishing address and the service URL will be resolved (for example) http: // localhost: 8080 / services / HelloWorldService . But when I try to go to http: // localhost: 8080 / services / HelloWorldService? Wsdl , I get 404. If I change the publication address at my jaxws endpoint to the absolute URL http://localhost:8080/services/HelloWorldService , I I can access wsdl.

I want to specify the relative endpoint address, if possible. I'm new to using CXF (and writing web services), so any help is much appreciated!

UPDATE 1:

Please note that I am deploying my web service for Tomcat 7. I don’t know what writes it, but one of the lines in my startup log state is Setting the server publish address to be HelloWorldService . If anyone needs more information to help me, please let me know.

UPDATE 2:

It looks like CXF detects if a CXFServlet is being used, and uses an instance of the built-in pier if it is not. http://cxf.apache.org/docs/xfire-migration-guide.html#XFireMigrationGuide-HTTPandServletSetup . So for some reason, CXF uses an instance of the built-in infield instead of my servlet. However, I do not know what additional configuration I need other than HelloWorldServlet in my web.xml, and the CXF documentation will not help me.

+7
source share
2 answers

The answer, of course, was simple (breaking dizziness, that is). In my cxf bean definitions, I did not import the cxf-servlet.xml file, as shown here http://cxf.apache.org/docs/servlet-transport.html . If this file is not imported, cxf assumes that it should use an embedded jetty instance instead of my CXF servlet. I assume that the mooring instance only works with endpoints indicating the absolute publication address.

+12
source

Must not be

 address="/HelloWorldService" 

?

0
source

All Articles