How to Buy Middleware Components

There's more to third-party packages than UI and grid-related tools. Learn how to save money and time with middle-ware components.

Technology Toolbox: VB.NET, SQL Server 2000, ASP.NET

Chances are, you picture a fancy user-interface component when you think of using third-party .NET components. And it's true: Powerful grids and eye-popping chart effects stand out in product demos and glossy advertisements, and you can find many strong third-party packages to supplement the front ends of your Visual Studio apps.

But there's much more to the third-party vendor scene than applications that augment the front end of your applications. Whenever you face a new complex programming task or don't have the time to get up to speed on it, there's a good chance that someone has been in the same position before with the same technology. If there's enough demand for expertise or programming convenience, a component vendor probably offers a robust, debugged solution for .NET.

You owe it to yourself to explore assemblies that can handle grunt work in the background before you begin coding your middle tier. Valuable packages in this space include Global Positioning System (GPS) and Geographic Information System (GIS) tools, reporting and printing tools, and data-connectivity and e-commerce products. This class of applications can prove especially worthwhile if you develop applications that venture into unfamiliar territory. This article takes a look beyond the dramatic hierarchical views, subtle hues and gradients, and design-time flair that make the popular UI components so appealing. Indeed, I'll discuss some components that include hardly any UI at all at design time, but nevertheless serve as the real workhorses and unsung heroes of the middle tier.

My goal isn't to recommend the specific packages that you can find, but to provide information on what kind of apps you can purchase, and what to look for when considering a purchase for a middle-tier application (see the sidebar, "What Factors Matter"). This article lists specific products by way of example, but VSM doesn't intend these mentions to be endorsements. The only endorsements in this issue come from VSM's readers specifically, in the form of the Readers Choice Awards. Rather, you should view the products mentioned in this article as examples that illustrate the buying principles described in this article.

The decision to buy or pass on a given middle-tier component isn't much different than a decision to buy or pass on a front-end component. It's generally accepted that purchasing the right component makes sense when you consider the time and money you save—that holds as much for the middle tier as the front end.

It isn't simply a matter of buying the most productive product relative to its retail price. It's critically important that you pay attention to the licensing terms of the packages you look at, as well as whether the products support both COM and/or .NET (see the sidebar, "Not .NET Yet?"). Some products are cheap out the door, but expensive to implement. You also have to look into a given vendor's support policies, not only in the near term, but also what they are likely to be for as long as you are likely to use that product in your application (see the sidebar, "What Factors Matter").

Buying Can Save Time, Money
I was struck recently at how much value these middle-tier applications can provide while tinkering with a GPS locator unit that came with Microsoft Streets & Trips. A colleague showed me how to use Windows HyperTerminal to view and capture the incoming satellite data appearing on the computer's COM port. As the lines of characters scrolled by in the 4800-baud data stream, I realized that I could write routines to parse and interpret those comma-separated codes and digits. However, I wasn't at all sure where to start.

At this stage, my thought process was that I could write the code. Of course, the thought that immediately followed that one was that someone had probably done this parsing job already, and that I could spend my time on other parts of the project. I was right about the parsing: Scientific Component offers GPS ToolKit.NET, a complete solution for turning GPS navigation data into readily usable content. Rather than spend an inestimable number of hours or days writing my own engine, I tapped into its toolkit and was off writing code that provided the functionality I wanted within minutes.

I plugged the USB-equipped receiver into the computer and located the correct COM port by trial and error; the vendor's sample application gave me exactly the position data that I needed (see Figure 1). The product's code samples also showed me how to interpret much more information, such as speed, altitude, and satellite details. Scientific Component sells the component's source code as part of its site license package. If your enterprise-critical GPS application depends on a compiled DLL—or the boss just likes the warm and fuzzy feeling of being protected against technology changes—the included source code can prove beneficial. For my part, I doubt if I'll have the knowledge, time, or inclination to work my way through the complicated code for a professional component.

Mapping is a natural companion for a GPS application. For example, it offers the ability to detect a delivery person's current position using GPS and show her the next closest stop based on a SQL database query. GIS technology is one of those areas where—pardon the pun—most of us need a map to know where to start. However, Spatially Aware sells a series of 100-percent managed code components in its Map Suite that get you up and running quickly (see Figure 2). A background in spatial applications and its terminology can give you an advantage in implementing such applications, but anyone can learn to create GIS applications, thanks to the dozens of samples ranging from simple demos for beginners to complex applications aimed at GIS experts. For example, I found it easy to create a dynamic layered map of Canada that displays only the cities with a population of more than 100,000.

When you buy a component as a newbie who is entering uncharted waters, you're looking for more than just the properties and methods the class exposes. Product support—call it handholding if you wish—is crucial. In my quest for local mapping data, I posted a question on one of Spatially Aware's discussion groups. Their customer support responded in 30 minutes with good tips on where to get files and an explanation as to why the Microsoft Streets & Trips data isn't available in the popular Shape (SHP) format that this company's component consumes. (The reason given is that detailed and up-to-date mapping data is expensive, so vendors use proprietary formats to keep the data exclusive to their software.)

Don't Reinvent the Wheel
When dealing with extensive and complex code, it often helps to create a wrapper to encapsulate and simplify the usage and to provide a uniform way to access functions. Trouble is, writing and debugging a wrapper can take longer than getting your head around the original core routines. This is another area where a third-party vendor can get your project back on track while you avoid reinventing the wheel. A good example in this vein is IP*Works! ADO.NET Data Provider from /n software. The provider lets you use familiar SQL syntax to add, retrieve, and update data for multiple Internet protocols such as POP, IMAP, SMTP, NNTP, and RSS. For example, you can use this provider to add IPWorksConnection and IPWorksDataAdapter objects to your ASPX page and set the protocol to RSS. You can then take advantage of these objects to use a familiar SQL SELECT query to retrieve a news feed and bind it to a data grid. There's no need to learn new syntax:

IpWorksConnection1 = _
	New IPWorksConnection _
	("protocol=rss; url=" & _
IpWorksDataAdapter1.SelectCommand = _
	New IPWorksCommand _
	("select itemid,title," & _
	" pubdate,link,description " & _
	" from default", IpWorksConnection1)

I often see participants in the newsgroups struggling with Active Directory queries, so I asked /n software whether it would consider adding LDAP to the data provider. The developers were quite receptive to the suggestion. Look for wrappers for more Internet protocols in future releases of the IP*Works! package.

Here's another case where a background component makes your life easier. Microsoft publishes advanced interfaces in its Telephony Application Programming Interface (TAPI). But your work is cut out for you using straight TAPI if you want to get into telephony projects. AFTek Software's CallControl gives you a much less involved introduction to telephony by encapsulating TAPI 3.1, enabling you to add remote data, audio, and video communications to your application using either a modem or direct Internet connection (see Figure 3). The control also includes a sample that shows you how to implement point-to-point video teleconferencing.

Sometimes you need to send and receive data over the Internet, but the only type of "feed" is HTML. Screen scraping from Web pages is a risky business unless the page content is tightly structured and stable. Parsing the markup yourself can get messy quickly if you're not an expert in regular expressions. This is where an oddly named non-visual component called WebZinc .NET by White Cliff Computing can make your task much easier. WebZinc .NET lets you treat a Web page like a Web service. It arranges the rendered HTML into a manageable object model, so you can program against it with a fair degree of confidence. To WebZinc .NET, an HTML page has collections of frames, forms, applets, paragraphs, tables, links, and images. You can reach individual items within those collections. For example, when you zero in on a single paragraph, you can use methods to consume specific text content:

WebZinc.OpenPage _
	(""). _ 

Let Others Handle the Dirty Work
The WebZinc .NET Property Browser helps you analyze the structure and properties of a live target page, enabling you to manipulate page parts you want to scrape or fill (see Figure 4). Once you know the names of the forms and input controls in a Web page, you can log in to the page and submit values programmatically. One of the sample applications shows how to use a Windows client to send fax information around the world for free by submitting the fax data to a remote printing service. Granted, you could use Internet Explorer's objects and some .NET classes to build this type of model for yourself. But when you're up against a deadline and short of resources, you might find it worth your while to pay a little to relieve some of the pressure you face.

A common non-UI requirement in the ASP.NET world is generating reports on the fly for immediate download from a Web site. You can find a host of .NET libraries for building documents in the ubiquitous Portable Document Format (PDF)—including a couple open-source libraries—but this is one of those areas where you need to check out the feature sets carefully. A higher-end component lets you add annotations, gradients, calculated form fields, and the ability to update, merge, and split existing files. Some vendors charge more for features such as document encryption or to use the DLL on a Web server. If ease of deployment is important, check the fine print or the DLL itself for references to Java or COM dependencies.

O2 Solutions targets its PDF4NET library at applications that must be scalable. Building PDFs from scratch is a code-intensive process with a fairly significant learning curve as you get a handle on the object model. To get you started, PDF4NET provides nearly 40 commented code samples that range from automatic page numbering to creating e-forms and watermarks. That said, the job would be a lot easier if vendors could implement more design tools for Visual Studio. For example, it would be far easier to set a header and footer, PDF page flow, and title page layout using WYSIWYG tools.

If you don't generate reports in PDF, chances are you generate them in Microsoft Office format. Oddly, Microsoft's hugely popular Word and Excel aren't suitable or recommended for heavy-duty production in a server environment because they don't scale well at all. Worse, they misbehave by throwing up modal dialog boxes that can stop a database-driven mail merge in its tracks. Microsoft's migration of its knowledge worker suite has made only baby steps towards .NET, and much of that progress is in its Visual Studio Tools for Office (VSTO) product. Yes, you can generate complete documents in XML for the latest version of Word, but that would be a major undertaking. Here's where third-party vendors such as Aspose and SoftArtisans help by providing scalable .NET code to read and generate Word documents and Excel spreadsheets without requiring Office on the server. Still, building a sophisticated Word document solely in code would be quite a task. To make designing document templates more efficient, SoftArtisans offers OfficeWriter, a tool that works within Word (see Figure 5). The components read from these templates to generate reports on the server. As with PDF controls, be sure to check that you're getting 100-percent managed code if deployment on a non-owned server is a concern.

You can go well beyond ordinary Excel reports by using third-party tools, such as the innovative package from Knowledge Dynamics. The company sells a do-it-yourself calculation engine that supports about 200 Excel formulas and functions. KDCalc.NET lets you build and test sophisticated spreadsheet applications within Excel to create a robust .NET component. You can use the resulting code on an ASP.NET site or as part of any server-side process. This is a boon for developers who are struggling to comprehend the complex specifications for an insurance rating engine and expressing the rules as VB.NET, C#, or SQL code. It is far easier to let the rating expert work out the intricate details in his or her familiar Excel environment.

Let the Expert Make the Rules
After the expert debugs the complex formulas and conditions in Excel, you generate the business rules as a .KDC file. The KDCalc.NET engine reads the file to produce the calculation engine. For fast deployment, you can use the supplied wizard to generate a spreadsheet-like ASP.NET Web interface (see Figure 6). If you work in a distributed environment across a network, you can expose the calculation engine as a Web service, sending data from a desktop application and returning computed prices to the user. This guarantees that everyone is using the latest version of the calculation engine and eliminates the need to distribute new spreadsheet files across the enterprise. With this solution, you don't need Excel on the server or the desktop. At first blush, the $2,499 price tag for a .NET server license plus $1,499 for the Excel-based designer might seem expensive. However, when you consider the megabucks typically spent on a complete enterprise application, this third-party solution can prove highly economical.

Security and peace of mind are more good reasons to turn to third-party components. Creating a database-driven, shopping-cart–equipped site in ASP.NET is no big deal for a competent Web developer. However, most developers are nervous about configuring security and e-commerce transactions, especially those that handle credit cards. If you write your own code to validate credit cards and deal with gateways, you live with a nagging doubt about your implementation being secure enough to keep the ever-circling bad guys from turning your site into front-page news. On the other hand, buying a mature credit-card component can give you some piece of mind because you're buying from a company with a proven track record in addressing such concerns.

In my own case, I spent days researching the response codes and then writing a class to interface with VeriSign's popular COM-based Payflow Pro component. I had to handle the pre-validation of the credit-card number, log each transaction in the database, and work up encryption routines. It would have been nice if I'd known about .netCHARGE at the time. This .NET component from Corporate Web Solutions gives you all these features out of the box, plus many more. For example, I found the ability to flip in and out of Test mode with automatic redirection to test servers extremely convenient.

.netCHARGE is an example of how to benefit from buying in a buy-vs.-build scenario. I was able to get a test credit-card page running in two hours, including the time to create a trial payment gateway account. (Note: Getting a real merchant number to go live is a separate step that can take an accounting department weeks to resolve, so get them started early.) At $125 per site, .netCHARGE supports Payflow Pro and more than 40 other payment processors. Also, its generic interface makes it far easier to switch from one processor to another than with my processor-specific version. This code is all you need to submit a test credit card to VeriSign using .netCHARGE:

Dim iResult As Integer =0
Dim Objcc As dotnetCHARGE.CC = _
	new dotnetCHARGE.CC()
Objcc.Amount =50.00
Objcc.Number = "4111111111111111"
Objcc.Month = 12
Objcc.Year = 7
Objcc.Login = "xxxdontask"
Objcc.Setting = "VeriSign"
Objcc.Certificate ="web/vbnet"
iResult = Objcc.Charge("payflowpro")

I admit: I found it disconcerting when I executed this code and it returned error 126, which means the transaction is "under review by Fraud Service." Fortunately, police sirens didn't howl outside and nobody cut off my Internet access. It turns out that this is an automated VeriSign feature with which you can set levels for transaction amounts and trap other potentially bogus content such as a client name of "John Doe." It shunts suspect transactions to a queue for manual review. If you want to experiment with e-commerce transactions, VeriSign offers free test accounts that use its Web-based VeriSign Manager (see Figure 7).

This survey touches on only a few of the non-UI components available for the .NET platform, and only one or two products from a given category of products. You'll find many more for specialty areas such as mathematics, statistical analysis, graphics, and data transformation. Remember: If you find yourself facing a task that is involved and requires writing a significant amount of plumbing or connectivity code, chances are someone else has written the code before, and is probably willing to sell you his effort for much less than it would cost to create it yourself.

comments powered by Disqus
Most   Popular
Upcoming Events

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.