Reputation: 1750
I've recently re-written a web services application to use CXF instead of Axis. The switch was easy enough, but I'm having issues deploying the webapp. Previously, with Axis, you could navigate to a page, served by Tomcat, that would list all Axis services; something similar to http://localhost:8080/axis2/services/listServices
. And to view a service's WSDL, I'd navigate to http://localhost:8080/axis2/services/Service?wsdl
.
After rewriting the services in CXF, I've found I don't really know how to deploy and configure the application. I've followed a basic CXF setup, where my application's web.xml
file imports a Spring config file, beans.xml
. I can war all this up just fine and deploy it in Tomcat, where it explodes just fine and no error logging occurs, but I cannot figure out how to even browse on the host to see a listing of the deployed web services.
Can I get some help and explanation for this? I'd like to understand how to configure CXF so that I know what URLs to use in order to list services and see their corresponding WSDLs. Feel free to explain this portion as if I were five years old; I'm a solid programmer, but deployment and configuration aren't my strongest areas of knowledge.
One thing I've noticed in trying to understand this is that the beans.xml file references an import of classpath:META-INF/cxf/cxf.xml
. I have no idea what this file is or where it is, but my assumption would be that it's probably needed and that I should probably understand its role. Would someone mind explaining that as well? Does Tomcat's web.xml
have anything to do with this configuration?
If I can provide any more information or configuration in order to assist with this post, let me know!
Here's my application's web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>WEB-INF/beans.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<display-name>CXF Servlet</display-name>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>inc</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
</web-app>
And here's my beans.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<jaxws:endpoint
id="accountService"
implementor="com.company.ws.data.services.AccountService"
address="/AccountService" />
<jaxws:endpoint
id="loggingService"
implementor="com.company.ws.data.services.LoggingService"
address="/LoggingService" />
<jaxws:endpoint
id="searchService"
implementor="com.company.ws.data.services.SearchService"
address="/SearchService" />
<jaxws:endpoint
id="validationService"
implementor="com.company.ws.data.services.ValidationService"
address="/ValidationService" />
</beans>
Upvotes: 3
Views: 8293
Reputation: 10004
You can access all the deployed webservices in http://localhost:8080/{YourwebApp}/services
Say suppose your webapplication is webapp1 then http://localhost:8080/webapp1/services
Upvotes: 5