About this task
Apache CXF provides a Maven archetype for creating Java-first web services. In the this section
we'll explore using it along with the Eclipse's m2eclipse plugin. Open Eclipse:
Procedure
-
From Main Menu: File>New>Other, Select "Maven
Project" under "Maven" category:
Example
-
Click Next to get the "Select project name and location" screen, accept its defaults,
and click Next again to get to the "Select an Archetype" dialog. On this page, enter "cxf"
in the Filter box and select the item with group ID of
org.apache.cxf.archetype
and artifact ID of cxf-jaxws-javafirst:
Example
If the CXF archetype is not already available in your Eclipse installation,
add it by selecting Add Archetype... with the following information:
- Archetype Group Id:
org.apache.cxf.archetype
- Archetype Artifact Id:
cxf-jaxws-javafirst
- Archetype Version:
- Repository URL:
http://repo1.maven.org/maven2
-
Then, Click Next. We need to fill the required fields, which we can do as below:
Example
-
Click Finish, the project skeleton will be generated with a
structure as below:
Example
Results
We have the project skeleton that we can start from now, and add Java methods to represent web
service operations we wish to implement. "HelloWorld.java" is the simple interface that this
archetype generates, along with an ready-to-run implementation (HelloWorldImpl.java) of it. Of
course both can be changed when implementing your own web service provider.
Since the CXF Maven archetype does not provide a test SOAP client or provide OSGi
deployment capability, in the next sections we'll show how to manually add in OSGi configuration
as well as use soapUI to make SOAP calls.