Supplied Demo Applications

Natural Business Services provides sample business services in the DEMO domain. All the Natural modules for these services are located in the SYSBIZDE library on the server. For more information about these services, see DEMO Domain in Natural Business Services Administration.

Note:
If the sample services are not listed in NaturalONE, have your Natural Business Services administrator run the CSRLOAD program to load the repository.

This section describes the various business service types used in the demo application and highlights several features of the subprograms supplied in SYSBIZDE. It covers the following topics:


Business Service Types

Each business service has a type, which is determined by the wizard based on user input. On the client, the type is hidden from the user. On the server, it determines which Natural Construct model is used to generate the service.

The business service types are:

Type Service
blank Arbsub (arbitrary subprogram)
1 Traditional
2 Object-Browse-Select without maintenance
3 Object-Browse-Select with maintenance
4 Object-Generic

A user may be able to identify which type a business service uses by its methods. The business service types are described in the following sections:

Arbsub (Arbitrary Subprogram)

This business service (Type blank) assumes that the subprogram associated with it was not generated by Natural Construct. As Natural Business Services has no knowledge of the methods or required input and output parameters, all parameters are exposed to the client and the DEFAULT method is created. You can rename this method, as well as create other methods, by modifying the business repository information for this service.

An example of this type is the Calculator service, which has four methods: Add, Divide, Multiply and Subtract. As these methods would have behaved the same way as the DEFAULT method, overrides were added when the Web service was generated; the #FUNCTION parameter required a different value for each of the four new methods. For example, the Add #FUNCTION method required an override of Add.

A developer determines the value of #FUNCTION and decides what the subprogram will require to perform the function. For example, the Calculator service in the business repository uses the CALC subprogram. If #FUNCTION is set to "Add", CALC executes the appropriate code.

The main drawback to the Arbsub business service type is the amount of control given to the client. For example, if a Web service developer accidentally set the #FUNCTION override to Divide for the Add method, a user who only had permission to perform the Add method could inadvertently perform the Divide function.

Tip:
If this is a concern, use an Object-Generic business service type.

Traditional

This business service (Type 1) has two subprograms associated with it: an object maintenance subprogram (generated by the Object-Maint-Subp model) and an object browse subprogram (generated by the Object-Browse-Subp model).

The typical methods associated with this type are:

  • Delete

  • Exists

  • Former

  • Get

  • Initialize

  • Next

  • Store

  • Update

  • Browse

An example of this type is the Customer business service, version 010101. The Browse method calls the ACUSTN browse subprogram. The other methods call the MCUSTN maintenance subprogram.

Object-Browse-Select (Without Maintenance)

This business service (Type 2) is created using the Object-Browse-Select-Subp model and behaves in the same manner as a Browse-Select subprogram. Internally, it is different since you only want to pass a limited number of rows across the wire at one time in a client/server environment.

The object browse select subprogram requires an object browse subprogram. Based on the keys for the object browse subprogram, the Object-Browse-Select-Subp model creates the FindBy… methods. The method names can be modified during generation and methods can be removed if they are not required. If the HISTOGRAM option is selected for a browse key in the object browse subprogram, the object browse select subprogram defines count methods for the key. The key values and a count are provided, instead of all the data for the record (using FindBy… methods).

An example of the Object-Browse-Select business service type is Order, version 020101. The FindByOrderWarehouseId method returns all data in Warehouse ID order. A related method, OrderWarehouseIdCount, returns only the specified warehouse ID and a count of the number of orders for that warehouse. This service uses the BORDN object subprogram.

Object-Browse-Select (With Maintenance)

This business service (Type 3) is also created using the Object-Browse-Select-Subp model and takes advantage of more features of the model. The CustomerWithContactData, version 020101, business service calls both the object browse and object maintenance subprograms from the same object browse select subprogram. To allow this functionality, an object maintenance subprogram was added to the Object-Browse-Select-Subp model specifications. This created four new methods: MultiMaint, Update, Delete and Store, which can be applied to the entire business service (i.e., a group of rows).

The action applied to each row is indicated by the row state, for example: U for Update, D for Delete, and A for Add. Each row sent to the server for maintenance requires a row state. For the server to apply these actions, the business method must be MultiMaint, Update, Delete or Store.

In general, the client never needs to use the Update, Delete or Store methods because the MultiMaint method handles all of them. The methods are supplied for security purposes. For example, if an administrator applied security at the method level to revoke Delete privileges for a user, the business service will not allow the user to use a D (for Delete) row state.

The CustomerWithContactData business service, version 020101, uses the BCUST2N object subprogram. The Object-Browse-Select service uses the ACUST2N object browse subprogram and the MCUST2N object maintenance subprogram.

Object-Generic

This business service (Type 4) allows the business service to access up to 10 subprograms and create up to 20 different methods. Each method can be clearly defined on the server by hard-coding certain values. This prevents security from being breached and allows one client interface to be used for multiple subprograms.

An example of this type is the CalculatorAdvance business service. This service calls the BNUM subprogram. BNUM accesses two subprograms: CALC and GCDN. As the data for these subprograms is similar, the exposed variables have been reduced (this is why some of the parameters are commented out in the generated PARAMETER-DATA user exit code). Before either subprogram is called, data must be moved from the exposed data area to the local data areas used to pass data into these subprograms. This is done in the generated MOVE-TO user exit code. Similarly, data must be moved back to the exposed data area before control is returned to the client. This is done in the generated MOVE-BACK user exit code.

While defining methods for the CalculatorAdvance service, the developer specified which subprograms to execute for each method, the execution order of these subprograms, and whether code should be executed before and/or after the subprogram. For example, the SolutionWithLowerNumbers method has code that is executed after the GCDN subprogram is executed. This method also executes the CALC subprogram. (Refer to the AFTER-CODE subroutine in the BNUM subprogram.) This code reduces the first and second number based on the greatest common denominator and then calculates the division between the two numbers.

The Subtract method executes code before the CALC subprogram is executed. Refer to the BEFORE-CODE subroutine to see how #FUNCTION is assigned. This process is similar to providing overrides for the Calculator service, except the Web service cannot change #FUNCTION for the Subtract method because it will always be overridden in the BNUM subprogram.

Features of the Demo Application

The SYSBIZDE demo application includes the following Web and business services:

Web Service Name (or business service name when different) Type Subprogram
Calculator Arbsub CALC
CalculatorAdvance Object-Generic BNUM

CALC

GCDN

CustomerCreditAnalysis Traditional MCUST3N
CustomerPlain

Customer, version 010101

Traditional

With browse

MCUSTN

ACUSTN

CustomerWithContactData Object-Browse-Select

With browse

With maintenance

BCUST2N

ACUST2N

MCUST2N

CustomerWithContactDataTraditional

CustomerWithContactData, version 010101

Traditional

With browse

MCUST2N

ACUST2N

ErrorMessageTesting Basic Arbsub FLIPSTR
FlipString Arbsub with defined method FLIPSTR
GreatestCommonDenominator (also used with CalculatorAdvance) Arbsub GCDN
Order Object-Browse-Select

With browse

BORDN

AORDN

OrderTraditional

Order, version 010101

Traditional

With browse

MORDN

AORDN

Product Traditional

With browse

MPRODN

APRODN

StringManipulation Object-Generic BSTRINGN

FLIBSTR

CSUCASE

Warehouse Traditional

With browse

MWHN

AWHN

Additional Feature When Using Predict

This section describes an additional feature of the SYSBIZDE demo application when using the Predict data dictionary.

ALLOW-LOWER-CASE Option

By default, an object browse subprogram converts all input data into upper case. The ALLOW-LOWER-CASE option allows users to enter data in lower case. It is useful for a field like Business Name, where the name is stored in mixed case.

Start of instruction setTo specify the lower case option

  1. Associate the ALLOW-LOWER-CASE keyword with the definition for the input field in Predict.

  2. Regenerate the object browse subprogram.

For more information, see Natural Construct Object Models.