2 Understanding Business Services

This chapter contains the following topics:

2.1 JD Edwards EnterpriseOne Business Services

JD Edwards EnterpriseOne provides interoperability with other Oracle applications and third-party systems by natively producing and consuming web services. Web services enable software applications written in various programming languages and running on various platforms to exchange information. JD Edwards EnterpriseOne exposes business services as web services. A web service is a standardized way of integrating web-based applications, and in JD Edwards EnterpriseOne, web services are referred to as published business services. Business services enable JD Edwards EnterpriseOne to expose transactions as a basic service that can expose an XML document-based interface.

2.1.1 Published Business Services

A published business service is a JD Edwards EnterpriseOne Object Management Workbench (OMW) object that represents one Java class that publishes multiple business services. When you create a web service, you identify the Java class. The published business service also contains value object classes that make up the signature for the published business service.

2.1.2 Business Services

A business service is a JD Edwards EnterpriseOne OMW object that represents one or more classes that expose public methods. Each method performs a business process. A business service also contains internal value object classes that make up the signature for the business service methods. These public methods can be called from other business service classes and published business service classes.

2.2 Development Methodology

JD Edwards EnterpriseOne provides tools to help you create business services and published business services. You access Oracle's JDeveloper from JD Edwards EnterpriseOne OMW. You should have one business service workspace based on the JD Edwards EnterpriseOne path code in JDeveloper. This workspace should have been created when JDeveloper was launched from OMW. Each business service and published business service has its own project under the business service workspace, where you can add and modify code for business services and published business services that were created using OMW. JDeveloper provides wizards that generate Java code to help you create business services and published business services. All business services and published business services are written in the Java programming language.

The JD Edwards EnterpriseOne business services framework provides a set of foundation packages. Each foundation package contains a set of interfaces and related classes that provide building blocks that you use to create the business service or published business service. Business service classes extend the BusinessService foundation class. Business service classes call business functions and database operations. The published business service class extends the PublishedBusinessService foundation class. This class exposes public methods that represent JD Edwards EnterpriseOne business processes as web services.

The business services framework also supports business service properties. Business service properties provide flexibility in the code by enabling users to set a value without changing the code. The business service framework includes wizards that provide building blocks to help you create business function calls and database operation calls. You also can access code templates. Code templates generate skeleton code that you modify and finalize. You can use code templates to generate skeleton code for creating public and private methods for a published business service, creating public methods for a business service, formatting data, calling a business service property, and testing a published business service.

JD Edwards EnterpriseOne business service and published business service classes use value object classes. A value object is an interface to a business service or a published business service. A value object is the high-level component that contains the business data that defines a business process. Business services use internal value objects, and published business services use published value objects. Internal value objects and published value objects and their components extend the ValueObject foundation class. Published response value objects, which are used by published business services, extend the MessageValueObject foundation class and contain warning messages that are returned from business function and database operation calls.

2.3 Value Objects

Value objects are a specific type of source file that holds input and output data, much like a data structure passes data. The input and output parameters of business service operations are called internal value objects. Business service internal value objects are not published interfaces. Business service operations use one internal value object for both input and output. Examples of internal value objects include InternalAddAddressBook, InternalProcessPurchaseOrder, InternalEntity, and so on.

The input and output parameters of the published business service business operations are called value objects. These parameters are the payload of the web service. A business operation defined in a published business service takes one value object as its input parameter and returns one value object as its output parameter. Examples of published business service value objects include AddAddressBook, ProcessSalesOrder, ProcessPurchaseOrder, GetCustomer, ConfirmProcessPurchaseOrder, and so on.

The structure of a value object is modeled after the business object document (BOD) defined by Open Applications Group, Inc. (OAGIS). The structure represents the hierarchy of a business process. The following example value object shows the hierarchy for AddAddressBook:

Figure 2-1 Value object structure

Description of Figure 2-1 follows
Description of "Figure 2-1 Value object structure"

Value objects are made up of components, compounds, and fields.

2.3.1 Components

Components are extensible building blocks of a value object and consist of compounds and fields or just fields. Examples of components are PurchaseOrderHeader, PurchaseOrderDetail, and EntityAddress.

2.3.2 Compounds

Compounds are collections of related fields and are implemented as classes. Compounds are basic, shared building blocks. Examples of compounds are purchaseOrderKeys, supplier, and item.

2.3.3 Fields

Fields are the lowest-level elements that are defined. Components and compounds, if used, consist of fields.

2.4 Package Naming and Structure

You use JD Edwards EnterpriseOne OMW to create new JD Edwards EnterpriseOne business service and published business service objects and to access existing business service and published business service objects. When you name a business service or published business service, you must use naming conventions that are compatible with OMW. You create business service and published business service objects in OMW, and then you start JDeveloper from OMW. JDeveloper automatically creates a project for the last OMW object that you created; using JDeveloper and the Project wizard, you create projects for each OMW object that you created.

The Java package that is created for business services and published business services is determined when you create an OMW object. The following are examples of package names:

package oracle.e1.bssv.JP010000

package oracle.e1.bssv.util.J0100020

A business service can be created in a utilities package (oracle.e1.bssv.util) if the business service provides a repeatable task that is consumed by multiple other business services. All other business services and published business services are created with the root package name (oracle.e1.bssv).

In the preceding examples, the portion of the name in italic font is the business service object name. To be compatible with OMW object names, this portion of the package name must be eight characters. The naming convention for the OMW object name is different for business service and published business service packages.

For a business service package, the OMW object name is J, system code, and numbers, where the numbers are a number that you assign to each business service; for example, J0100001, J0200002, J0100010, J0100020, J0100100, J0100110, and so on. The OMW object name must be eight characters. The following diagram shows the structure for a business service.

Figure 2-2 Business service package structure

Description of Figure 2-2 follows
Description of "Figure 2-2 Business service package structure"

For a published business service package, the OMW object name is JP, system code, and zeros (for example, JP010000). The OMW object name must be a total of eight characters. The naming standards do not preclude the creation of a second published business service per system code; however, our guideline is to create one service per system code. The naming convention for the OMW object is also part of the name of the package where the published business service class resides. Within the JDeveloper tree structure, a published business service must be directly under the package name. For example, the published business service AddressBookManager.java can be under oracle.e1.bssv.JP010020 only; it cannot be under a subpackage of JP010020. The following diagram shows the structure for a published business service:

Figure 2-3 Published business service package structure

Description of Figure 2-3 follows
Description of "Figure 2-3 Published business service package structure"

Each business service and published business service must have its own package name. You cannot include both a business service name and a published business service name together as one package. For example, the package name oracle.e1.bssv.JP010000.J0100020 is invalid.

2.5 Java Coding Standards

You use JDeveloper and the Java programming language to create JD Edwards EnterpriseOne business service and published business service classes that run in a J2EE environment. The business services foundation package provides classes that you extend when you write your code. The business services foundation and JDeveloper provide wizards that help you structure your code. JDeveloper enables you to set preferences for placing braces and then reformats the code to your desired style.

You use basic Java programming style conventions when you write your code. For example, instead of sprinkling literals and constant values throughout the code, you should define these values as private static final variables at the beginning of a method or function or define them globally. Another convention is to use uppercase letters for each word. You should separate each pair of words with an underscore when naming constants, as illustrated in this code sample:

private static final String DEFAULT_ERROR = "c39f495121b...etc"; 

You should include meaningful comments consistently throughout your code. For easier readability when you create a Java class, order the elements in the following way:

  1. Attributes

  2. Constructors

  3. Methods

The code that you write should check for null and empty strings, as illustrated in this example code:

if ((string != null) && (string.length() !=0))   
                     or
if ((string == null) || (string.length() == 0)) 
                     or 
if ((string == null) || (string.equals(""))) 

Your code should check for null objects. You can use this sample code to check for null objects:

if (object !=null)
{
  doSomething()
}

When you compare strings, use equals(). This code sample shows the correct way and the wrong way to compare strings:

String abc = "abc"; String def = "def";
// Correct way
if ( (abc + def).equals("abcdef") )
{
  .....
}

// Wrong way
if ( (abc + def) == "abcdef" )
{
   ......
}

When you create published value objects, the code should test for null objects in the set methods. This code sample shows how to test for null objects:

public void setCarrier(Entity carrier)
 {
   if (carrier != null)
     this.carrier = carrier;
   else
     this.carrier = new Entity();
 }