![]() |
A 3-tier distributed architecture includes the following three components. Refer Figure 1.
1. Database Server 2. PowerBuilder
Application Server 3. GUI Front End This article discusses the role of application server and non-visual user objects in the development of Internet and Intranet applications using PowerBuilder 5.0. It discusses the pros and cons of two different approaches for developing such applications. Application
Server Intranet
and Internet Development Approach
1 : Executable Content 1. A plug-in enabled browser such as Netscape Navigator, Internet Explorer, etc. 2. A run time PowerBuilder window plug-in. This plug-in enables you to open a PowerBuilder window that can contain all of the standard PowerBuilder graphical controls such as tab controls, tree and list views, graphs and OLE objects. The plug-in can also make use of datawindows. In this approach, all you need to create are the .pbd files. A .pbd file can be downloaded on the browser (client machine) and you see the PowerBuilder application windows on the browser screen. Refer Figure 2. There are certain precautions you must take when programming such a system. For example - all PowerBuilder windows must be child windows, the code that links to the database must be placed either in the datawindow itself or be referred through a distributed object on the application server. Any validations in window scripts must be strictly avoided. Ideally, the .pbd files should be as small as possible. This enable easy download over the Net.
Advantages
Disadvantages
Example Figure 3 shows an example of a PowerBuilder child window displayed as part of the Netscape Navigator window. This window functions just like any normal PowerBuilder window except that it is displayed as part of the browser window. Such a window is part of the PowerBuilder library - a .pbd. The .pbd resides on the server. The browser loads the window when it encounters the following tag: <embed src=windows_plugin.pbd width=370 height=320 window=w_product> The windows_plugin.pbd is the PowerBuilder library. The w_product is the child window displayed in the browser window. The width and height parameters indicate size of the child window.
Approach
2 : Dynamic Content You prepare a HTML page with forms and submit it to the pbcgi050.exe. This file - pbcgi050.exe - must reside in your Web servers cgi-shl directory. It interacts with your PowerBuilder Application Server. The server in turn communicates with the database and the result set is dynamically shown on the client browser. For example, if you inquire for a specific product range, the inquiry goes to the Web server. The file pbcgi050.exe talks to the application server which in turn communicates with the database server and gets the product range in a datawindow. The datawindow is converted into HTML table and forwarded to the client browser. All this is done automatically. The only thing you need to code is the HTML form that sends the product inquiry to the Web server. Refer Figure 4.
Advantages
Disadvantages
Example Lets consider the example of making product inquiries using Web front end against your product database. A user object function of_get_data is defined that searches for the product description given the product name. The HTML code that calls the of_get_data function is as follows: <FORM
METHOD="GET"
ACTION="/cgi-shl/pbcgi050.exe/of_get_data"> The PowerScript function of_get_data accepts one argument - the name of the product- and returns the complete description of the product. Conclusion A 3-tier architecture uses an application server as the middle tier that hosts the non-visual user objects. The business logic of your application is encapsulated in the non-visual user objects. PowerBuilder has introduced web.pb and Internet Development Kit that enable development using the techniques discussed in the article thus providing a complete Internet enabled application development environment. |