CXF Part 1

Using the CXF framework we will create a simple web service, deploy it in a service of type 'Web' and finally create a web service client that calls it.

First thing to configure is the workbench path to the CXF framewotk, this is only done once

Configure CXF framework

In workbench window->preferences point to the xtellus360\apache-cxf folder 


CXF has a xml file in WEB-INF\cxf-servlet.xml with configuration. CXF also has a servlet where the available services are displayed. 




Create Server Project

In workbench create a new project of type 'Dynamic Web Project'  we will call it MyWS




Next create a Tomcat 8 service and call it MyWS add the project MyWS to the new service. The service is created in the service view



The service will look like this in the service view. The service port is set to 8090 in our example


A demo wsdl file is copied into the newly created project. The demo.wsdl can be found in a forum group called Tool Code. In this example the service will be created from the wsdl.  



Next generate service template from the wsdl file. This will generate everything except the implementation of the service methods.

First screen where we change the runtime to CXF


Next screen the package name is specified for the generated classes



The default values are used at the rest of the screens. 
The generated project now looks like this


 
The DemoImpl.java class has a method getPrice where the service functionality is implemented.

The MyWS service could now be started in the service view by right-click and select debug, the service should start without problem at port 8090

The CXF servlet can now be called at http://127.0.0.1:8090/MyWS/services

Starting a browser at the address will show 


And the wsdl link show the wsdl