Apache CXF 101 Win Eclipse development Environment Building

Source: Internet
Author: User
Tags apache tomcat

Objective

There has been no progress in the article "SOA ecosystem approach" in the draft blog, and it is felt that it is necessary to articulate the concepts of SOA, Web Service (WS), and rest.

Heaven must be site, here to record some "lowbrow" practice, the main study of Apache Axis2 and Apache CXF two Java Service Development framework, first from CXF.

Directory

1 Tools

2 Apache CXF configuration in Eclipse

3 Running Instances

4 references

Content

1 Tools

Windows 7

Eclipse Juno (4.2.0, JEE version, build-id:20120614-1722)

Apache CXF 2.4.2 (newer version 2.7.11 some inexplicable errors during configuration, fall back to the lower version), CXF extract directory as Cxf_home

Apache Tomcat 7.0

2 Apache CXF configuration in Eclipse

Window->preferences->web SERVICES->CXF 2.x PREFERENCES->CXF Runtime Add runtime, specify CXF extract directory

3 Running Instances

Expected target: Create WS from bottom up (bottom-up), deploy WS to the servlet container, observe the WSDL of the service, call the WS interface through the browser.

Create dynamic WEB Project projects

Project structure (add index.html)

The expected project Facets

Before

After

Writing Service Implementation classes

 Packagecom.spike.cxf;ImportJavax.jws.WebService;/*** Description:helloservice implementation<br/> * date:2014-5-11 pm 7:59:33*/@WebService (targetnamespace= "http://cxf.spike.com/", PortName = "Helloserviceimplport", ServiceName = "Helloserviceimplservice") Public classHelloserviceimpl { PublicString getversion () {return"1.0"; }     Publicstring Greeting (string user) {return"Hello" + user + "!"; }}

Add CXF Facets based on Dynamic Web project: Right-click service implementation class, Generate Web service

Configuring the WS Type

Service Endpoint Interface (SEI) selection or creation, where default

Select the Service method note, where the default

CXF JAVA2WS configuration, here Default

Start the service (actually a servlet container) wait

Service Publishing mode setting, default here

Click on the project structure after finish

Package Explorer

Project Explorer

"Configuration" of the servlet container, with 8082 ports selected

Access Service Http://localhost:8082/CXF/services

Click the WSDL link http://localhost:8082/CXF/HelloServiceImplPort?wsdl

Invoking the Service interface method

(1) http://localhost:8082/CXF/services/HelloServiceImplPort/getVersion

(2) Http://localhost:8082/CXF/services/HelloServiceImplPort/greeting?arg0=zhoujiagen

4 references

[1] jax-ws with Apache CXF and Eclipse [step1] http://angelozerr.wordpress.com/2011/08/23/jaxwscxf_step1/
[2] Jax-ws with Apache CXF and Eclipse [step2] http://angelozerr.wordpress.com/2011/08/24/jaxwscxf_step2/

Related Article

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.