Using IBM worklight for server-side mobile application Development (III)

Source: Internet
Author: User
Tags db2 file system ibm db2 ibm db2 database web services

Integration of IBM Worklight adapters with RESTful services

Brief introduction

By reading this article, you will learn how to develop and test a JPA exposed RESTful service application using IBM Rational application Developer for WebSphere, Version 8.5.1 's developer Workbench. You will then learn how to develop and test a mobile application that contains a server-side adapter component that uses the previous RESTful service application. IBM Worklight supports the development of server-side components to invoke business logic encapsulated in Java, Web services, RESTful services, and Enterprise JavaBeans (EJB) components. It is part of the IBM MobileFirst Mobile enterprise application development platform.

Use case architecture

This article uses the same use cases developed in part 1th. Entities UseCase and usecases are generated from the FIPSDB base usecases table, the IBM DB2 database, using the Java persistence API (JPA).

The use-case implementation consists of 8 different activities, which can generally be grouped into the following steps:

Develop a JPA application using Rational application Developer.

Develop a JPA test client application using Rational application Developer.

Test the JPA server application in the Rational application Developer using the JPA test client application.

Exposes the JPA server application using the RESTful service application.

Test the JPA RESTful Service application with a Web browser.

Develop a mobile application using Worklight Studio.

Merges the provided JPA RESTful Service application logic as a Java archive library into the mobile application.

Use worklight Studio to test your mobile application, which is also an end-to-end test for a complete scenario.

Develop a JPA application using Rational application Developer

The following steps list the process of implementing JPA application development using the Rational application Developer for WebSphere Version 8.5.1.

Start Rational application Developer and specify the workspace location on the file system:

C:\temp\RADWS\Part3

If the Java Enterprise Edition (Java ee) Perspective for Java application development is not already open, open it (Window > Open Perspective > Other > Java ee), and then Click OK.

To create a new Java EE project:

Select the New Dynamic Web Project Creation Wizard: File > New > Dynamic Web Project.

Enter project name: Wlusecasesjpaproject

Leave the default settings for the remaining options.

Click Next two times.

On the Web Module page, select the Generate web.xml deployment descriptor option, and then click Finish.

If you see a hint, specify yes when you see the option to select Yes or No to turn off the Open associated perspective? dialog box window.

Package Explorer of the Java EE perspective now shows the newly created Java EE project.

Select JPA Project Aspects:

Select Wlusecasesjpaproject > Properties.

Select Project Facets, and then select JPA.

Click further configuration available.

Select Fipsdb from the Connection drop-down menu.

Select the radio button for the annotated classes must is listed in Persistence.xml.

Select Create Mapping File (orm.xml).

Accept the default values for the remaining options.

For Modify faceted Project, click OK.

For the Properties for Wlusecasesjpaproject, click Apply.

Select Jax-rs (RESTful WEB Services) Project aspects:

Select Wlusecasesjpaproject > Properties.

Select Project Facets, and then select Jax-rs (Rest Web Services).

Accept the default values for all other options.

For Modify faceted Project, click OK.

For the Properties for Wlusecasesjpaproject, click Apply.

For the Properties for Wlusecasesjpaproject, click OK.

To configure the JPA database connection:

Create the Fipsdb back-end database and fill in the data. See the project file provided in the download section for data definition and fill data.

Choose Window > Open Perspective > Jpa to open the JPA perspective.

Select Data Source Explorer > Fipsdb (DB2 Alias) > Properties > Driver properties > Test Connection (see Figure 1).

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/

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.