Motivation to write this blog came from the desire to develop a SAPUI5 based application and deploy on the cloud. It is fairly easy to consume OData based services in UI5. For example you can see how abhilash.gampa developed an UME based SAPUI5 application which is based on OData service. In this case it was great that SAP NetWeaver Gateway was providing the OData service. What if you want to develop an application from scratch? How do you make your application REST and JSON enabled to consume them in UI5. Scratching that itch resulted in this blog :smile:
The most important part of such an application is to figure out how various things play with each other. In our case we have to figure out how are CXF, Spring and Servlets are wired together. Fortunately this has been made easy with the availability of a Maven archetype ( something like a project template). In this blog we will use the org.apahce.cxf.archetype to generate our sample project. Then we would refactor few things to understand the generated code. I would also talk about how various things are tied together in the generated code.
Prerequisites
Since CXF is such an important part of this project, let us make sure it is configured properly by going to Window à Preferences
As you can see I have my CXF installed at the “Location” and it is version 2.6.1.
How to Steps
Fireup your eclipse and create a new Maven project by File -> New -> Other -> Maven -> Maven Project
Skip the default option on the next screen (“Select project name and location”) and hit Next. You would land on the “Select an Archetype” dialog. Make sure All Catalogs is selected and look for the archetype org.apache.cxf in Filter field
Select the archetype with the Artifact Id cxf-jaxrs-service and hit Next. Specify various parameters
Click on finish. If you have prayed to your Maven and CXF gods correctly you should see a new restez project in the navigator with the following structure
By default the cxf archetype sets up the Dynamic Web Module version to 2.4 to the project. But NW Cloud as of now is based on 2.5 so we have to change the Change the Dynamic Web Module version from 2.4 to 2.5 in the project. Right click on project name and go to project properties dialog. In this selct the Facets options and make the necessary change as shown below.
Now we are ready to deploy this generated application. If you are feeling lucky or are the adventurous kind go ahead and deploy the application on the local NW Cloud instance. Or you can wait for the second part of the blog where we would cover the inner workings of this generated app, how it is wired and how to use Advanced Rest Client to talk with it. Till then happy cloud building.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
13 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |