The Practical Applications of NetBasic WebPro
Articles and Tips: article
The NSS Group
01 Jun 1997
Provides in-depth information on WebPro, a module of NetBasic that allows developers to create secure Internet and Intranet applications on a NetWare server, as well as manage a Novell network remotely via the Internet.
One of the least publicized features of NetWare 4.11 is the high-level scripting language NetBasic, which allows end-users to produce their own NLMs without resorting to C or assembler programming. Despite the fact that it is one of the most powerful and useful additions to NetWare 4.11, it is all too easily overlooked.
Although the interpretative shell and language elements within 4.11 are fully functional, there are additional products available which extend the functionality of NetBasic even further.
NSS Network Testing Laboratories has carried out a detailed evaluation of the NetBasic product family, and this DevNote was produced to provide background information on NetBasic WebPro and the technologies behind it, as well as some ideas for practical applications.
The first section will provide an introduction to the idea of client-server and client-network computing, before going on to explain Novell's DeveloperNet 2000 architecture and the NetBasic product line. For those of you who are not interested in how it works, but want to get straight into how to use it, you can skip ahead to the second section, which provides a number of sample case studies.
Networks have taken off in a big way over the last few years. Applications which once ran on large mini-computers or even mainframes are now running on large corporate networks, which offer a much more attractive price-performance ratio. Alongside this, the development of client-server technology to run on these networks has meant that large corporates can transfer even their biggest applications to the humble micro.
NetWare is the perfect host for such applications, since its basic "building block" approach of using NLMs to add functionality to the core server product is an ideal vehicle for third-party developers.
Client-Server vs Client-Network
As work practices changed over the years, the need to share resources and information-the spreadsheets we had created on our standalone PCs, for instance-became increasingly important. This need was satisfied by the introduction of the Local Area Network (LAN), which ushered in the client-server era.
In addition to simple resource sharing, the data sharing capabilities of our networks were enhanced by the development of true client-server applications. Thereafter we saw much of the data processing load transferred from the client to the more powerful server, thus providing a more efficient and cost-effective means of servicing the complex data requirements of a large number of users.
This, in turn, brought about the need for more flexibility in the location of the presentation logic, business logic and the actual data, in order to provide the best combination of performance and fault tolerance under any given situation. The result was the development of the three-tier, client-server architecture, which has introduced an additional layer of servers into the traditional client-server paradigm in order to provide the necessary distributed computing architecture.
With each evolutionary step, we are increasing the flexibility of the network model by adding more servers. But that model is still somewhat server-centric, and until recently, we have gained access to our centralized resources by logging on to a specific server or group of servers.
Client-network computing is actually a logical evolution of the way we currently approach our computing, allowing us to move away from a server-centric model to a network-centric one-the client is now attached to the network rather then a specific server.
This, of course, is a move begun with NDS (Novell Directory Services), which allows a client to access numerous network resources without having to be concerned where they are physically located. No matter how many servers are involved around the world, the client sees only a single set of services.
In September 1995, Novell announced an initiative (code name DeveloperNet 2000) to develop an open set of APIs (Applications Programming Interfaces) to expose all the functionality of network services to developers building distributed network applications. The new breed of client-network applications which are beginning to appear are far more distributed in nature. This allows the user interface logic, business logic and content logic can be partitioned and perhaps even located on separate servers to more efficiently utilize the available network resources.
As more and more applications are written to take advantage of network services, components and applications become much smarter, having the ability to register to the network, discover other services and logic dynamically, perform distributed tasks, be shared, and more easily managed. This is the ultimate vision of Novell's "Smart Global Network", and one of the key components of this is DeveloperNet 2000.
The DeveloperNet 2000 NMX engine provides a standard way in which NLMs and Basic components can register and execute within the NetWare operating system. It allows the loading and unloading of components-whether NLMs or Basic scripts-on demand, thus handling libraries on an "as needed" basis, maximizing free cache memory, and thus improving performance.
Just one example of how this could be used to good effect is where an administrator could write a simple Basic script to load the backup NLM at a specific time, rather than leave it loaded all day. This obviously frees up vital memory for normal processing until the backup routine is actually required, perhaps overnight. All the necessary security required to control and access components is also handled by the NMX engine.
The NMX engine is open to a range of desktop application tools-including NetBasic, Visual Basic and Java - as well as supporting the CGI interface to Novell's Web server, which opens up access to DeveloperNet 2000 components over the Internet. It is interesting to note that the DeveloperNet 2000 NMX engine and the NetBasic APIs-both developed by HiTecSoft-have now been licensed back to Novell for inclusion in NetWare 4.11 and IntraNetWare.
In the past, writing NLMs for NetWare has required detailed knowledge of C or assembler. What HiTecSoft has done is to create a much higher level abstraction of the NetWare C library, making all the standard functions available to NetBasic programmers. NetBasic itself is a high-level scripting language which is very similar to Visual Basic, with the result that the writing of complex or custom server-based tools and utilities is now within the reach of a whole new section of the programming community.
Anyone who is familiar with Visual Basic will feel instantly at home with both the NetBasic language and the Windows-based Integrated Developer Environment (IDE). The language itself needs no explanation or introduction, since generations of programmers have cut their teeth on it before moving on to more "grown up" languages. And just when everybody thought Basic was dead, along came Microsoft with Visual Basic, which has gained a place in many a programmer's tool kit in recent years.
NetBasic follows in a similar vein, whilst adding a great many custom extensions to handle the DeveloperNet 2000 APIs. These extensions are grouped logically and prefixed with identifiers such as NDS, NET, PORT and WIN to indicate their general usage (access to NDS, networking, communications, and server console screen handling functions respectively). The screen handling functions, together with a large number of pre-built modules, make it a simple matter to build utilities with the standard NetWare "C-Worthy" interface. Included in the package are also a huge number of sample scripts demonstrating access to most of the language functions, and some of them duplicating dearly departed 2.x and 3.x utilities such as FCONSOLE.
Any of these scripts can be run from the server console using the NetBasic Open Interactive Shell. This provides a similar environment to the standard DOS prompt, as well as offering a consistent shell interface on all platforms.
A number of NetBasic utilities (which can be examined, edited and changed if required) duplicate most of the standard DOS commands such as CD, DIR, COPY, TYPE, CLS, REN, as well as a number of the DOS-based NetWare utilities such as VOLINFO, USERLIST and SLIST. This provides you with an almost perfect DOS environment at your NetWare console, allowing you to copy, move, type and rename files without having to dash to and fro between server and workstation.
Whilst NetBasic programs can easily be written using any text editor and run under the Shell, HiTecSoft recommends the use of the Visual NetBasic system, a Windows-based IDE with built-in code management facilities, compiler and debugger. This provides a much more structured approach which is especially useful when building large projects.
Although NetBasic Pro stands on its own as a development environment, there are a number of additional modules available or planned to further enhance the possibilities of such a tool. These include database modules (for Oracle, Btrieve and dBase), backup modules (for ARCserve and Backup Exec), fax module (for FAXserve), UPS modules (for APC and Exide), SNMP module, and Internet module.
NetBasic WebPro is one of the first to be released, and provides the ability to create secure Internet and Intranet applications on your NetWare server, as well as manage your NetWare network remotely via the Internet.
NetBasic WebPro naturally includes the standard NetBasic Pro, but adds to that a whole host of DeveloperNet 2000-compliant Internet API extensions together with the Database Module for Btrieve. The Internet functions-which are an extension of the NetBasic language, each with a "DOC" prefix - simplify the generation of HTML code from an application, allowing Web pages to be built on the fly using dynamic data.
An interface component then connects the Web Server's CGI interface to the DeveloperNet 2000 architecture. Coupling this with the Btrieve module provides access to Btrieve databases using any Web browser either on the Internet or the corporate Intranet. In the normal course of events, Web pages are static. Stored as files on a Web server, they require manual changes to HTML code in order to reflect new information, and this can often be a full-time job for one person. Unfortunately, this often involves duplication of effort, too, since the new sales figures which the webmaster is laboriously copying to the Web server have already been entered onto a computer system either in another manual operation, or as part of an automated Sales Order Processing system. The biggest problems with the manual Web update are that it is prone to error during the transcribing process, and the Web site is often not up-to-date.
Using NetBasic WebPro, however, up-to-the-minute data can be retrieved from corporate databases and placed directly on to Web pages in real-time. Customer and order data can be gathered using NetBasic programs, transmitted to your company via the Internet and stored in Btrieve, Oracle or dBase databases.
In order to facilitate business transactions over the Internet, the final component of the package is the NetBasic Secure Web Server. This is the first secure web server for NetWare, which secures all transactions using RSA encryption and SSL (Secure Sockets Layer) technology. Included in the package are scripts which demonstrate how easy it is to create a simple order entry application, and access corporate Oracle database files. A standard Web Server is also included for those who do not require secure transactions, and a version of the software is available which includes the standard Web Server only.
Since we now have a logical link between the Internet and our NetWare server, it is a relatively simple matter to allow network management over the Internet via NetBasic. Included in the Internet module are a range of sample utilities which allow secure login to a NetWare 4 server, followed by the ability to browse the NDS tree listing user and container details, load and unload NLMs, view a snapshot of the contents of any of the current monitor screens, edit configuration settings and AUTOEXEC.NCF files, and much more.
Even for those who are not interested in doing business over the Internet, the NetBasic for Internet module is well worth a look for the remote management capabilities alone.
In this section of the article, we examine a number of possible real-life applications of the technology, presented as a series of fictitious "case studies."
Case Study 1 : The Network Manager
Problem. Joan is the network manager of a large corporate network. There are several branch offices situated around the country each with at least one, and often several, NetWare 4.x servers. Joan is the only experienced network administrator in the organisation, and is faced with the task of regularly commuting between branch offices in order to fix relatively minor problems.
Because she has to travel regularly with her job (the organization has locations around the globe), some problems can rapidly get out of hand as she finds herself unable to gain immediate access to servers from remote locations. At the moment, she has to liaise with non-technical users on each site in order to try to ascertain the problem, after which she has to talk them through complicated (for them) procedures to try and rectify things. Often, the simplest solution is yet another trip to the site in question with all the costs that entails, including Joan's time and traveling costs.
Solution. By installing NetBasic WebPro (with included Web server software) on each NetWare server, Joan immediately gains access to those servers over the Internet. Even when she is away from the office in her hotel room, using any standard Web browser-such as NetScape or Internet Explorer-she can now dial into a local Internet Point Of Presence (POP) anywhere in the world, and enter the Web address of the server she requires access to.
NetWare's own powerful security and authentication mechanism takes over at this point to query Joan for her NDS or Bindery login ID and password. After authenticating her, NetWare allows access to the Web server where she is presented with a comprehensive list of options.
First she elects to view the system console to check on any error messages which may have appeared. Noticing that one particular NLM has generated an error, she selects that NLM and views the console screen.
The error is one that appears infrequently and causes no real damage to the system, and the cure is simply to reload the offending NLM. So, using NetBasic via her browser she selects the NLM, unloads it, and reloads it-the problem is fixed within two minutes of attaching to the Internet.
She then logs onto another server located across the Atlantic, yet still she only pays for a local call into the nearest Internet POP. The new server shows signs of problems with one of the disks, so using NetBasic utilities Joan checks for any open files on the volume, sends a message asking those users to log off, and then fires up a simple monitoring utility so that she can see when all the open files are closed.
Next, she disables logins so that no more users will try to access the faulty drive, dismounts the volume, and runs Novell's VREPAIR utility to fix the problem. Once the drive has been remounted, she uses NetBasic to browse the volume and notices that that there are a large number of .BAK files in several directories. In order to create some extra space, she schedules a job (NetBasic Pro includes a job scheduling utility) to run at 3am which will search for and remove all .BAK files on the system which are greater than one week old.
Another site has reported a problem with a user account, so Joan flips into the NDS browser utility and scans the appropriate container and object records via her Web browser. Having spotted the source of the problem, she now runs the NetBasic version of the NetAdmin utility which is supplied as part of the package, amends the object data, and saves it back to the NDS database.
Finally, someone has reported a possible fault with the APC Uninterruptible Power Supply (UPS) on their server. Joan switches to that server using her Web browser and, via the NetBasic UPS module she can view the UPS statistics, determine the state of the battery and run some diagnostic self-test routines to ensure that everything is OK before retiring to the hotel bar for the evening.
Case Study 2 : Software Distribution/Config Control
Problem 1. Peter is a network administrator with a common dilemma. He works for a company which operates a two-shift system from 6 a.m. to midnight, and he has a network-based application which is in constant use throughout that period. He needs to make some changes to the configuration files for the application, but they are held open constantly making them inaccessible unless the application is closed down. Given that the application is considered virtually "mission critical" Peter could not afford to close it down for mere maintenance for more than a couple of minutes.
However, the task of ensuring that all users log off simultaneously on all 50 servers throughout the organization whilst he copied a few files is clearly not a trivial one. He is therefore faced with coming in after hours to perform such updates.
Solution 1. Peter designates an off-line copy of the file set as a "master" and makes all the necessary changes to those files. He then uses the NetBasic task scheduler to run a NetBasic script at 3 a.m. when the system is sure to be unused. The script first checks that the files are no longer open, and clears the connection of any users still logged on. It then copies the files from the master set to the correct location on each of the 50 servers. The application, complete with new configuration files, is then ready for use by the 6 a.m. shift that morning.
Problem 2. Peter also needs to upgrade one of the Windows-based applications on each of the 500 workstations in the company. Having performed a couple of trial installations already he has identified a core set of program files which need to be copied to various directories on each workstation. However, certain elements of the installation differ depending on the workstation configuration-including the copying of hardware-specific program files and changes to one or two lines of the Windows configuration files on the local hard disk of each machine. The only way around the problem is to install the upgrade manually on each of the workstations.
Solution 2. Once again a NetBasic script is scheduled to run at 3am which tidies up the old installation and copies the new server-based files to every server in the organization. A change is also made to the login script of all servers which forces a NetBasic script to be run when each user next logs into the network.
The script runs through the Windows configuration files line by line and, depending on what it finds there, makes the appropriate changes. The correct files are then copied to the user's local hard drive, and an attribute is set against that user in the NDS database to indicate that the upgrade has been completed successfully.
Case Study 3 : The Sales Executive
Problem 1. Mike is a sales executive who is out on the road most of the time, rarely returning to the office. In order to function efficiently, he obviously requires access to the latest product details and prices. His company believed they were using computers effectively when they replaced the old paper-based price lists with a system which allows each sales executive to dial-in to Head Office and download a product catalogue and up-to-date pricing information directly to his or her laptop.
Unfortunately, there is only a single line designated for remote access in this manner, resulting in a busy signal on many occasions and constant frustration for the sales executives. Costs are also high, since wherever Mike is in the world, he must always dial in to the Head Office number, often from an expensive hotel phone.
Mike also feels that the remote access software he is forced to use to download this information is unfriendly. The result is that he frequently avoids downloading the latest price lists and catalogues, risking presenting a potential customer with out-of-date information. He uses NetScape quite a lot to browse the Internet and is familiar with it. He has already asked the head of the MIS department if it would be possible to set up a Web site containing all the product information, but the reply was somewhat negative. The MIS department feel that they do not have the resources to support a full-blown Web server which is open to the outside world. They also feel that it would be a duplication of effort, since the pricing and product information is already maintained in a central Oracle database on one of the NetWare servers.
Solution 1. By installing NetBasic WebPro on the NetWare server, it is possible to extract data directly from the Oracle database and build Web pages on the fly. Thus, it is not necessary to maintain the same data both in the Oracle system and on the Web site, and because the Web server is used purely in an Intranet environment, the general maintenance overhead is minimal. Naturally, the content can be developed further as and when required, and the Web server can even be opened to the general Internet community at a later date.
For the sales executives, however, the benefits are immediate. Mike no longer has to perform lengthy downloads using unfriendly software. Now when he arrives at a customer site he connects his laptop to his cellular phone and using familiar Web browser software, he can gain direct access to the latest product and pricing information straight from the Oracle database on the Head Office server. Because the Internet is geared towards graphical presentations, the on-screen catalogue can even include pictures of the products.
Problem 2. As each order is taken, Mike is expected to complete a substantial amount of paperwork in order that the order details can be entered into the computerized order entry system from standardized input forms. Once a week, the order forms are packaged up and shipped to the head office for data entry personnel to key in the order details to the Oracle-based Sales Order Processing System. Most of the sales executives dislike the form-filling, and the delay in submitting orders to head office can often result in delays on time-critical orders.
Reports providing cumulative sales figures and comparing them against last year's sales and current year's targets are vital to Mike, yet these too must be produced in hard copy form at the head office, and either collected in person or mailed to Mike's home.
Solution 2. As Mike discusses order details with the customer, the relevant information is captured directly into an on-screen form via his NetScape browser. Once the order is confirmed, it can be transmitted securely (fully encrypted and protected) across the Internet to the head office server.
A NetBasic script takes the order details and writes them directly to the Oracle database, thus ensuring that sales order entry is performed in a timely manner, eliminating delays and reducing the need for dedicated data entry personnel. A similar script can extract sales data from Oracle and present the cumulative sales reports and comparisons directly to Mikes Web browser, thus providing the most accurate and timely information possible.
Case Study 4 : The Financial Director/CFO
Problem. Carol is the Financial Director of a large manufacturing concern. She is keen to keep on top of the financial situation at all times, yet remains unfamiliar with the detailed workings of the main computerized accounts systems. She does have a laptop computer, but the only software she uses regularly-and is thus most comfortable with-is NetScape, which she uses both at home and at the office for E-mail and for browsing the Internet. In order to receive regular updates of the accounts figures, she is therefore forced to assign one of her staff the task of running selected reports, summarizing the information and E-mailing it to her.
Solution. After installing NetBasic WebPro, the MIS department write a few simple scripts to extract key data directly from the Btrieve files used by the accounts system, and present it in both a textual and graphical format in an HTML document. Now, whenever Carol requires an up-to-the-minute appraisal of the accounts position, she simply accesses the appropriate page on the corporate Web site, the script is activated and the accounts data is retrieved and presented via Carol's Web browser dynamically. Carol can now run her reports whenever and wherever she likes, and the information presented to her is always completely accurate and up-to-date. She is also pleased that she is able to use exactly the same interface for accessing information-in her case Microsoft's Internet Explorer-at home as she does at work.
Case Study 5 : The Customer
Problem. Bob is a loyal and long-standing customer to Acme Inc., but as the company has become more successful, Bob has noticed that the quality of customer service is not what it used to be. Although the customer service department has expanded, so has the customer base, so that Bob often encounters the busy signal when trying to check on the progress of his order. He also resents waiting on hold for twenty minutes or more simply to find the latest price of an item.
Solution. Acme installs NetBasic WebPro which allows the latest product and pricing information to be made available on the Web without having to dedicate staff to maintaining the Web site.
Now Bob can peruse the Acme product catalogue and price list using his favorite Web browser, and can find all the information he needs without ever having to contact the sales department.
The system can provide even more sophistication if required. By entering details of all the products he wishes to order, the system can provide Bob with an accurate quotation automatically. When he is ready to place an order, Bob can browse selected fields from the Acme NDS database in order to find the direct-dial telephone number of the appropriate sales executive.
Case Study 6 : Placing an Order
Problem. Despite the fact that Bob has saved so much time in researching his order details, he is still subjected to a lengthy wait on hold before being allowed to place his order. Acme is faced with either expanding its sales department or losing valued customers.
Solution. By installing the secure version of the NetBasic Web server, Acme is equipped to take orders over the Internet. New customers are asked to register their details which are stored directly in the Oracle database back at Acme head office. They are then presented with a unique account number which can be used the next time they wish to place and order.
Existing customers simply quote their account number together with a password, and their details are immediately retrieved from the Oracle database and presented on a dynamically-created Web page for confirmation. Any information captured can be passed from page to page, allowing Acme to "personalize" its Web pages and retrieve key information when the customer is ready to place an order.
The customer then browses the catalogue adding the required items to the order. Once an authorization code, purchase order number or credit card details have been entered, the order is submitted directly to the sales order system for processing. All details submitted over the Internet are protected by a powerful encryption mechanism to ensure absolute privacy.
Case Study 7 : Customer Information
Problem. Acme has several extremely important customers who regularly place large orders which are called off and delivered in small batches. These customers need constant progress information on their orders, yet find it inconvenient to have to keep making telephone calls to the customer service department.
Solution. Selected customers may be provided with a password which provides access to a secure part of the system. Here, they can enter an order number or a range of order numbers and have the NetBasic script query the Oracle database and present them with the latest progress details of their orders. Customers can now have instant information without tying up valuable sales staff.
Case Study 8 : The Backup Dilemma
Problem. Alex is a network administrator facing a common problem with his backups. His backup software is only capable of scheduling jobs for a specific time, yet he can never guarantee that all applications have finished their overnight processing runs and closed their files at the time the backup commences. The result is a high frequency of incomplete backup jobs, which leaves his company exposed to severe data-and financial-loss in the event of disaster.
Solution. Using NetBasic Pro with one of the available backup modules allows Alex to create a backup regime which is "application driven" rather than "time driven." Now, whenever a particular application finishes processing, it can activate a NetBasic script which will ensure that all users are logged off and the appropriate files are closed before it schedules an immediate backup job which is designed to protect the files which are specific to that particular application.
Backup jobs can be scheduled using a single NetBasic call, passing simple information such as the user name, password, server, volume, directory and file information. It is also possible to initiate backup jobs remotely over the Internet and completely automate backup and restore processes via simple NetBasic scripts.
Case Study 9 : Reducing Fax Costs
Problem. A large organization with branch offices around the world uses Cheyenne's FAXserve to provide most of its external communication as well as a means to deliver marketing messages to its customers. Since the marketing effort is coordinated from a single country, fax mail-shots entail a large number of international calls, and fax costs are rising to an unacceptable level.
Solution. Using NetBasic Pro with the FAXserve module, it is possible to control all of Cheyenne's fax services via a single call from a NetBasic script. The fax is now prepared for sending and then submitted across the Internet to each of the offices-this entails only a local call to the Internet Service Provider (ISP). Once the fax has been transmitted to the servers in each country, those servers then uses FAXserve to transmit the fax to its intended destinations within that country. Once again, instead of a number of costly international calls, we are now only making a number of local or national calls within each country, thus benefitting from a huge cost saving.
Cost savings can also be realized for single fax transmissions by front-ending the fax server in each country with a NetBasic script which performs fully-automatic least-cost routing, transmitting faxes across the Internet wherever possible instead of incurring international call charges.
Case Study 10 : Making Sure Everyone is Up-To-Date
Problem. A company has a number of Web servers throughout the organization. For historical reasons, each is hosted by a different operating system, including NT Server, Unix and NetWare. Most of the top level pages of each Web site should be identical across all Web servers, but keeping the files synchronized correctly following changes is proving a nightmare.
Solution. Since Point-to-Point Protocol (PPP) and File Transfer Protocol (FTP) are platform independent, the NetBasic FTP module provides the means to synchronize files on each of these diverse platforms. A NetBasic script is created for the NetWare server which is scheduled to run at a set time each night. This script checks for any changes to the HTML files on the Web site, and transfers all modified files automatically to each of the other platforms. The FTP module with NetBasic WebPro can be used to provide all manner of fully automated software distribution, file copying, migration and replication tasks across multiple platforms and servers.
The NSS Group
The NSS Group is the UK's foremost independent network testing facility and consultancy organization-an organization devoted to the needs of the networking professional. Based in Bedfordshire, England (also with offices and testing facilities in France), The NSS Group offers a range of specialist IT and networking services to vendors and end-user organisations throughout Europe and the United States.
The Group consists of six wholly-owned subsidiaries:
Network Subscription Service
NSS Consultancy Services
NSS Network Testing Laboratories
NSS Editorial Services
Network Subscription Service-the publishing arm of the Group-offers an independent information service providing detailed quarterly reports and monthly newsletters on the latest network-related technologies. NSS Network Testing Laboratories services the testing requirements of the Subscription Service as well as offering its facilities and expertise to third parties for private commissions.
The Group's remaining subsidiary companies provide consultancy services (from network design to installing an Internet/Intranet server), technical writing, training (both technical and business oriented), and hardware.
This article is reprinted by permission of The NSS Group. All rights reserved.
The NSS Group Network House, PO Box 297, Bedford, MK44 1YR, England Tel. +44 (0)1933 413636 Fax. +44 (0)1933 359021 E-mail : NSSinfo@NSS.brand.co.uk Internet :www.NSS.brand.co.uk
* Originally published in Novell AppNotes
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.