XML

Business Services Components

As mentioned in tutorial 10, business services components encapsulate the business rules of a system. Since there are many different types of business rules, there are also many different types of business services components. When we work with XML, the two types of business rules we'll be most concerned with are the rules that validate user input in user services components and the rules that define how XML data will be returned to the client from the server. These two types of rules require two completely different types of business services components.

The components that define how XML data is returned to the client run on a server machine. In a Web application, these components usually run on the Web server. Using the DOM objects, we can create and retrieve data in either XML format or in other formats that can be easily transformed to XML. The business services components can be called by an Active Server Page (ASP) that can then return the data to the client. For example, you could create a Microsoft Visual Basic business services component that retrieves data from a database, manipulates the data and converts it to an XML data island, builds the appropriate DHTML script, and embeds the XML data in the DHTML script. This Visual Basic component can then be used by an ASP to return the data to the client. Because we have already discussed the DOM at great length in tutorial 11, we will not discuss these types of business services components here.

The business services components that we will discuss in this tutorial are the components that validate the user's input. This type of component should be placed on the client whenever possible so that the user's input can be validated immediately. As we mentioned in tutorial 10, if these business services components are placed on the server, a delay in the application can occur every time a request is sent to the server for validation. These delays can affect performance.

When you build a standard nonbrowser based application, it can be relatively easy to create business services components that validate the user's input. For example, you can create a wide range of components in Visual Basic that can perform the validation. Visual Basic has a special type of object called a data source class that can be used to create objects that automatically bind to objects on a form such as text boxes and grid controls. If you are working with a Web-based application, you could also use programming languages such as Visual Basic to build business services components, but there is another option. You could use HTML Components (HTC) to create an application that is completely Web based. At the moment, HTCs are supported only by Internet Explorer 5, but it's likely that in the future they will be supported by other browsers in different environments. An HTC can also be used to write code for the events that are raised by the business services components in the browser. Since these events are raised by the user's input, an HTC can be ideal for validating the user's input. Let's look at how to build business services components using the HTC.