1

Answer: I know this is not the kind of thing that goes well as far as resolutions go, but I fiddled around with the web.xml and servlet.xml files, and for some reason, it works now, I can get the service list and wsdl files just fine now. I compared my new files to the old ones written below, and the only differences is that the web.xml has the name CXFServlet instead of LoginService, and I have given the cxfservlet.xml endpoint an address now.

I have a issue where I have (Finally) made a CXF webservice deploy on Tomcat. Or, rather, it does start, and it does not produce any warnings or exceptions in the tomcat log when I deploy and redeploy. The problem is that I can't retrieve the WSDL of the service in question. I am beginning to think that I don't understand the web.xml and cxf.xml files as well as I thought.

When I write http://localhost:8080/services/Login?wsdl I would expect the WSDL to pop up, but all I get is a 404. What am I doing wrong? As I said I am not getting any exceptions, so what is my problem?

Edit: Due to some helpful feedback (that I remembered to mark as helpful) I realized that I might have set the context path wrong in my web.xml. I deploy the service through the manager app in tomcat in a file called LoginService.war. This begs the question: Can I even do that? Will tomcat know to look for the CXFServlet class in the LoginService lib, or will it look in the ROOT? Do I need to reconfigure the server to allow me to run from http://localhost:8080/LoginService?

web.xml

<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<display-name>LoginService</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:metadata/Login/cxfservlet.xml</param-value>
</context-param>
<listener>
<listener-class>
  org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>LoginService</servlet-name>
<servlet-class>
    org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginService</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
</web-app>

cxfservlet.xml

 <beans xsi:schemaLocation="http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://cxf.apache.org
 /jaxws http://cxf.apache.org/schemas/jaxws.xsd">
 <jaxws:endpoint id="LoginService"
 implementor="orgserver.services.Login" wsdlLocation="WEB-INF/LoginService.wsdl"
 address="/">
 </jaxws:endpoint>
 </beans>
3
  • 1
    You write address="/". So try localhost:8080/services/?wsdl
    – user647772
    Feb 17, 2012 at 11:54
  • Am I at least understanding this correctly?: I am specifying the class CXFServlet to be run on every provided url resembling /services/*. That CXFServlet class is what takes the bean I specify in the cxfservlet.xml file as an endpoint and handles the webservice actions? It is also the CXFServlet that is responsible for returning the WSDL? Feb 17, 2012 at 12:05
  • And would any errors during this process be recorded somewhere else than the main tomcat log? Feb 17, 2012 at 12:07

1 Answer 1

5

You shouldn't need to set wsdlLocation unless there is another way to get to your service besides http://localhost:8080/services/. Also wsdlLocation would be a URL.

I'm assuming that you have deployed your app to ROOT.war (root context) in Tomcat since there is no context path before /services.

What is displayed when you browse to http://localhost:8080/services (no trailing /)? It should give you a list of services available, including the WSDL address. If you mouse over the WSDL address it will show you the actual URL.

4
  • Then I navigate to localhost:8080/services it gives me a 404 same as otherwise. I tried changing the context path to /LoginService which is what the war is called, an tried localhost:8080/LoginService and it still gives me a 404. Feb 19, 2012 at 12:04
  • I tried placing a simple index.html file in the LoginService war file, and I can navigate to that with localhost:8080/LoginService. I deploy the LoginService.war via the manager html app. I changed the Context Path to /LocalHost/services/ but I am still not getting a list of services when I call localhost:8080/LoginService/services. Am I not calling at the CXFServlet class at all? Is there any way to see if the CXFServlet fails due to an error? Feb 19, 2012 at 12:18
  • Changing my Context Path to LoginService/services gives me an error in the tomcat manager: "FAIL - Application at context path /LoginService could not be started." There is nothing in the log other than the "Starting" message. No errors. Feb 19, 2012 at 12:35
  • I have no idea why, but I got it to work now, I posted the answer in the original question Feb 19, 2012 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.