pp108 : BusObjects

BusObjects

This topic describes BusObjects in WS-AppServer and how they are used.

A BusObject is the Base Java class representing a business object in WS-AppServer. It typically represents a record in a database table that can be persisted. It is dynamic in nature and behaves according to the event that uses it. A BusObject is wrapped in XML and undergoes change as per the business logic that is executed on it. A BusObject is used in SOAP requests for the following activities:

  • Inserting objects
  • Updating objects
  • Deleting objects
  • Querying objects
  • Validating objects

Representation (in a SOAP request)

In WS-AppServer, object data is represented in the form of an XML document. The structure contains a root node and elements. The root node represents the type of the object, and the elements represent the attributes. The purpose of keeping object state as XML document is to prevent transforming XML into normal Java objects. Additionally, XML supports implementation of meta properties to attributes such as access null='true', and it is also compatible with SOAP and XQY.

Consider the following sample object namedCustomers.

<Customers>
    <ID>123</ID>
    <Name>John</Name>
    <City>London</City>
</Customers>

In the above example, <Customers> is the root node, which indicates the BusObject type and <ID>,<Name>, and <City> are the attributes of this BusObject.


CAUTION: To address performance issues, never explicitly delete the BusObject NOM nodes and any relevant BusObject data that WS-AppServer has created. WS-AppServer is programmed to automatically delete the NOM nodes it has created, if necessary.

Protocol for Using BusObjects

WS-AppServer dictates a protocol for creating, updating, and deleting BusObjects. A combination of tuple/old and tuple/new elements are used to frame requests that perform the create, update, and delete operations. The following table describes these combinations.
Table 1. Tuple Elements in SOAP Requests

Element

Purpose

<tuple><new>

Create a BusObjectFor example,

<Update>
    <tuple>
        <new>
            <Customers>
                <ID>123</ID>
                <Name>John</Name>
                <City>London</City>
            </Customers>
        </new>
    </tuple>
</Update>

<tuple><old>and<tuple><new>

Update or Validate a BusObjectFor example,

<Update>
    <tuple>
        <old>
            <Customers>
                <ID>123</ID>
                <Name>John</Name>
                <City>London</City>
            </Customers>
        </old>
        <new>
            <Customers>
                <ID>123</ID>
                <Name>John</Name>
                <City>New York</City>
            </Customers>
        </new>
    </tuple>
</Update>

<tuple><old>

Delete a BusObjectFor example,

<Update>
    <tuple>
        <old>
            <Customers>
                <ID>123</ID>
                <Name>John</Name>
                <City>London</City>
            </Customers>
        </old>
    </tuple>
</Update>

Note:

  • If multiple objects need to be committed to the database, all objects are committed sequentially, using the handleAllInOne() method. In case of dependency of any object on another object, the former is skipped. At the end, all skipped objects are committed one after another using the handleOneByOne() method. The changes are persisted into the database only if all objects are committed. Otherwise, the transaction is aborted.
  • The tuple that is sent by the SOAP request is transformed into a Java object by the WS-AppServer service. WS-AppServer provides a response to each request that it receives. However, the responses of only Update and Validate requests contain tuples. A response tuple may differ from the request tuple because of the WS-AppServer logic that is applied on the object.

Related concepts

Object Relational Mapping in WS-AppServer

Related reference

Mapping of BusObjects in WS-AppServer
Structure of a BusObject
States of a BusObject
Passing the Parameters of BusObject Class
Retrieving Information about a Class
Returning the Objects of BusObject Class
Creating and Using Composite Classes

Related information

Managing Transactions Using WS-AppServer