Novice use of Apache CXF problem Summary

Source: Internet
Author: User

Apache CXF creation requires dozens of jar package dependencies, for beginners may be endless pit, constantly looking for jar download jar I certainly did so step by step to jump the countless pits, but fortunately finally I succeeded!

As jar package dependent: 650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/M00/6B/94/wKiom1Uw1e_wStFFAAKiclmNkec819.jpg " Style= "Float:left;" title= "$E 4_jzoq3bd~ddr]wl87br8.png" alt= "Wkiom1uw1e_wstffaakiclmnkec819.jpg"/>


Link: http://pan.baidu.com/s/1hqnH2eg Password: Y4VW

You may not believe it, do you really need it? So many dependent packages?

The answer is yes, it is true, one can not be less, sincerely recommend that you use MAVEN for project management, you will appreciate all the conveniences that Maven brings to you!!!!!!!

A few lines of Pom fix everything, so easy!


These packages will need to be integrated with spring (life himself with Spring 4.x Apache CXF 3.0), in fact, integration is very simple, not much nonsense to say the following:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6B/94/wKiom1Uw1cmgek2WAAMrvNLRR-c705.jpg "style=" float: Left; "title=" ulw7e) z}0z~t1t_r$l~k0) o.png "alt=" Wkiom1uw1cmgek2waamrvnlrr-c705.jpg "/>

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>

The header information that needs to be introduced into the configuration file is as follows:

<?xml version= "1.0" encoding= "UTF-8"? ><beans xmlns= "Http://www.springframework.org/schema/beans" xmlns: Mvc= "Http://www.springframework.org/schema/mvc" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns:p= " http://www.springframework.org/schema/p "xmlns:context=" Http://www.springframework.org/schema/context "xmlns: Jaxws= "Http://cxf.apache.org/jaxws" xsi:schemalocation= "http://www.springframework.org/schema/beanshttp:// www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/mvchttp:// www.springframework.org/schema/mvc/spring-mvc.xsdhttp://www.springframework.org/schema/contexthttp:// Www.springframework.org/schema/context/spring-context.xsd Http://cxf.apache.org/jaxws http://cxf.apache.org/ Schemas/jaxws.xsd ">

Just pay attention to those cxf.


Web. XML requires a servlet configuration:

<web-app xmlns= "Http://java.sun.com/xml/ns/javaee"    xmlns:xsi= "http://www.w3.org/2001/ Xmlschema-instance "   xsi:schemalocation=" http://java.sun.com/xml/ns/javaee http:// Java.sun.com/xml/ns/javaee/web-app_2_5.xsd "   version=" 2.5 ">      <display-name>DataCollector</display-name>    <context-param>           <param-name>contextconfiglocation</param-name >          <param-value>classpath*:config/ applicationcontext-*.xml</param-value>      </context-param>       <listener>          < listener-class>org.springframework.web.context.contextloaderlistener</listener-class>       </listener>  <servlet><servlet-name>collector</servlet-name>       <servlet-class>           Org.springframework.web.servlet.dispatcherservlet      </servlet-class> </servlet><servlet-mapping>      <servlet-name>collector</ servlet-name>      <url-pattern>/rest/*</url-pattern></ Servlet-mapping><servlet>         <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>/ws/*</url-pattern>      </servlet-mapping></web-app>



The configuration is over. Let's look at the specific classes and annotations:

@WebService (endpointinterface = "Cn.com.flaginfo.ws.interfaces.HelloWebService") public class Hellowebserviceimpl    Implements hellowebservice{@Override public string greeting (string s) {return "Hello world!";    } @Override Public String greeting2 () {//TODO auto-generated Method stub return "DD"; }}
@WebServicepublic interface Hellowebservice {public string greeting (string s); Public String greeting2 ();} Good luck my QQ827741251 Welcome to exchange!

This article is from the "Quiet value" blog, so be sure to keep this source http://wangyangchao.blog.51cto.com/6439139/1633950

Novice use of Apache CXF problem Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.