1.CXF集成web項目,是經過org.apache.cxf.transport.servlet.CXFNonSpringServlet進行集成 javascript
2.servlet java
- public class WSServlet extends CXFNonSpringServlet {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @SuppressWarnings("static-access")
- @Override
- public void loadBus(ServletConfig servletConfig) throws ServletException {
- super.loadBus(servletConfig);
-
-
- Endpoint.publish("/helloWorld", new HelloImpl())
- .publish("/cal", new CalculatorImpl())
- .publish("/userService", new UserServiceImpl());
-
- }
- }
經過Endpoint.publish發佈,咱們webService全部服務都在此發佈 web
3.配置咱們servlet apache
- <servlet>
- <servlet-name>WebServiceServlet</servlet-name>
- <servlet-class>com.cxf.servlet.WSServlet</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>WebServiceServlet</servlet-name>
- <url-pattern>/ws/*</url-pattern>
- </servlet-mapping>
<url-pattern>/ws/*</url-pattern>不要配置成<url-pattern>/*</url-pattern>,不然你訪問那個頁面都會跳到 app
websevice 服務列表的頁面,你想也頁面也就沒法到達了 ide
訪問咱們wsdl地址,例如咱們本機http://localhost:8080/02_cxf/ws/userService?wsdl url
這樣就能夠了,配置完,你能夠試着訪問你的wsdl。很簡單吧! spa