Go to primary content
Oracle® Retail Integration Bus Service-Oriented Architecture Enabler Tool Guide
Release 16.0
E80322-01
  Go To Table Of Contents
Contents

Previous
Previous
 
Next
Next
 

10 Implementation Guidelines For Restful Web Services

This chapter provides a set of implementation notes that may be helpful when implementing the Oracle Retail Service-Oriented Architecture Enabler (RSE) tool. The information included here is intended to provide guidance on the following topics:

Important Note About this Chapter

The implementation notes in this chapter are intended to provide some guidance in the development and deployment of the Web service layer. This information does not take into account the implementation of the business logic required to complete the application API layer.

The RSE tool and approaches described in this section are complex. A high level of skill and knowledge of the product is required to complete these implementation tasks. Also required is technology specific development of application APIs and the business logic that is needed to complete it.

Any issues that may arise with development tools, development environments, custom APIs, or custom message flows are the responsibility of the customer and not Oracle Retail.

PL/SQL Provider Service Implementation Notes

The distribution (.zip) file includes a .ear file that contains all the generated code for the service; it is ready to be deployed to the application server. The business logic can be implemented in PL/SQL packages in Oracle. The distribution contains the specification and body scripts for the packages called by the deployed service.

To complete implementation, follow these steps:

  1. Create the PL/SQL service provider distribution file using the RSE tool. The output of this process is the .zip file.

  2. Extract the <service_name>ProviderImplSpec.sql and <service_name>ProviderImplBody.sql files from the distribution zip file.

    These files are modified to provide a PL/SQL implementation for the service.

  3. Extract the <appname>-service.ear file from the distribution zip file. This file is the generated Web service that is deployed.

  4. Create the JDBC data source.

  5. If not already deployed, deploy the Oracle Objects to the appropriate database user.

  6. Modify the PL/SQL body file for the business logic implementation. The <service_name>ProviderImplBody.sql file contains comments about where to implement logic for each method on the service.

  7. Install the modified PL/SQL packages to the database. They are called by the Web service methods.

  8. Deploy the <appname>-rest-service.ear file to the WebLogic Application Server.

Java EE Service Provider Implementation Notes

The RSE tool creates the appropriate provider restful resources as well as a skeleton implementation layer where the developer implements business logic. All of this is packaged inside the provider distribution archive file.

The Java EE Provider distribution file provides a sample deployable application and all the libraries that can be used to create Web services using retail payloads. The distribution file follows the naming convention of <appname>_JavaEEServiceProvider.zip. For example, the distribution file for the RMS application is named rms_JavaEEServiceProvider.zip. The <rms> prefix must be replaced with the name of any other application being developed.

The Web services generated by the RSE tool can be implemented and deployed in a number of ways. This section includes three implementation use cases for reference.


Note:

See the section, Important Note About this Chapter.

Use Case 1: Complete the Generator Provided Stub Code Implementation

  1. Generate the distribution file using the RSE tool.

  2. Extract the <appname>-service-ejb-impl-src.jar file from the zip file.

  3. Extract the <appname>-rest-service.ear file from the zip file.

  4. Add business logic code where indicated in the Impl java files.

  5. Use the java jar command to re-build the <appname>-service-ejb-impl.jar file.

  6. Use the jar command to update .ear file with the new implementation jar.

  7. Deploy the .ear file to the server.

Use Case 2: Provide a Custom impl jar to the RSE Tool

  1. Create custom java classes that implement the <service_name>ServiceProvider interfaces contained in the <appname>-service-provider.jar file.

  2. Extract the ServiceProviderImplLookupFactory.properties file from the .ear file.

  3. Modify the properties file to point to your implementation classes for the services.

  4. Use the jar command to create a jar containing your implementation classes, as well as the modified properties file.

  5. Run the RSE tool again and provide the new custom implementation jar file.

  6. Extract and deploy the generated .ear file to the server.

Use Case 3: Package the Generated Service Classes in an Existing Application

  1. Generate the distribution file using the RSE tool.

  2. The service interfaces are provided in the <appname>-service-provider.jar file in the distribution file. This jar file should be included in the application classpath.

  3. Source code of sample implementations for the service interfaces are provided in the <appname>-service-ejb-impl-src.jar file in the distribution file. (If application developers want to use the same classes in their application, they can extract the java files from the jar file and include those in application source code. They also can add their own business logic in the method implementations. If they decide to write their own implementations, they should make sure that the appropriate service interfaces are implemented.)

  4. After writing the Web service implementations, the java files should be compiled. The class files can be included in a new jar file or in the same jar file used for the rest of the classes of the application.

  5. Modify the ServiceProviderImplLookupFactory.properties file to include appropriate class names of service implementations and include it in application classpath. A recommended approach is to include the properties file in the jar file that contains the service implementation classes.

  6. Make sure that the following jar files are included in the application ear file:

    • <appname>-service-provider.jar

    • Jar file containing the service implementation classes

    • jersey-client.jar

    • retail-public-payload-java-beans-base-<version>.jar

    • retail-public-payload-java-beans-<version>.jar

    • retail-soa-enabler-<version>.jar

  7. Include web-module in the application.xml of the application. The module name should be same as the name of <appname>-rest-service.war file.

  8. The .ear file is ready for deployment on the server.

Deploying the Web Service

Below are the steps for installing the <service-name>.ear on WebLogic:

  1. Create managed server on Weblogic for REST deployment.

  2. Make sure that the managed server is up and running.

  3. Create datasource as listed in the section

    Creating a JDBC Data Source in WebLogic.

  4. After creating data source, navigate to Deployments Page.

  5. Click "Lock and Edit" located on the right side pane.

  6. Click Install. Browse the <appname>-rest-service.ear file to deploy and click

    OK.

    Use managed server created above to deploy.The deployed application is listed under Deployments and should be in Active State.

  7. The URL to test a web service is like this: http://<host>:8080/rms-rest-service/SupplierResource/4/5.

  8. In the above example, "rms-rest-service" is the context of web application in ear file, SupplierResource is the name of service, and the numbers are values supplied for path parameters for the web service.

    The above URL makes a call to the GET method of the web service.

  9. For testing all other operations you can install SOAP-UI. And provide the URL of the WADL to create test cases. A sample URL of the WADL is http://<host>:8080/rms-rest-service/application.wadl

  10. It will show all the operations that are available for a web service. You can enter request xml and execute the web service method.

Creating a JDBC Data Source in WebLogic

To create a JDBC Data Source in WebLogic Server, follow these steps:

  1. Select Data Sources from Home Page.

  2. Click Lock & Edit located in the right pane.

  3. Click New and select Generic Data Source from pop down.

  4. Select Resource Type as javax.sql.DataSource.

  5. Enter Name as, RetailWebServiceDs.

  6. Enter JNDI Name as, jdbc/RetailWebServiceDs and Click Next.

  7. Select Database Driver as, "Oracle's Driver(Thin) for Service connection; Versions:Any.

  8. Click Next button. Uncheck the option for "Supports Global Transcations" and click Next.

  9. In Connection Properties section, enter the following details:

    • DatabaseName: <sid>

    • Host Name: <host name>

    • Port: <port number>

    • password: <database password>

    • Confirm Password: <Same database password as above>

  10. Click Next.

  11. Click the Test Configuration button.

  12. After Connection test succeeded, Click Next.

  13. Select Managed server that is created for REST service deployment.

  14. Click Finish.