Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Serving Business Graphics from a Web Service

In this previous article, you built a VB.NET chart server that used XML and XPath to serve up business graphics. This article explains how, with the help of a couple extra tools, you can extend the chart server to consume and display results specifically from a Web service.


advertisement
ost graphics packages require you to format your XML data to a specific standard before they can output any charts, a method which robs you of the flexibility that makes XML valuable in the first place. This loss is unnecessary, since it's relatively easy to create a data agnostic charting application in which the data comes from any http source as XML, as demonstrated in my last article. In this article, I'll show you how to take full advantage of XML's flexibility. Using the same concepts and code, you'll use SOAP to expand the chart server's functionality to consume Web Services.

This article will walk you through the process. First, you will create a Web service that exposes SQL Server data from a sample NorthWind database via a Web service. Next, using the Microsoft SOAP Toolkit, you'll enhance your charting server to consume the data and chart it. Lastly, you'll build a sample bar chart showing all of the products in stock from the NorthWind database.

Preparation
To attach your application to a Web service in Visual Studio.NET, use the 'Add Web Reference' functionality within the project explorer window. This generates classes that implicitly handle the SOAP messaging between your application and the target Web service. This form of binding is very useful—but is limited. The software designer has to explicitly declare at design time the connection to the Web service.



For the chart server to be as flexible as the URL based one from the earlier article, the facility to discover and consume SOAP based Web services has to be done at run time. Visual Studio.NET is limited in how it can achieve this, but can be expanded on by downloading and installing the Microsoft SOAP toolkit. The toolkit supports the extended functionalities. I will walk you through this process later in the article.

If you haven't done so already, you also need to install the SQL Server desktop engine included with Visual Studio.NET. Note that if you select the desktop engine as part of the Visual Studio installation, the engine will not install. You still need to run its installation file. This file (Setup.exe) is located in the Setup/MSDE directory in the Visual Studio.NET installation folder. This installs a SQL Server with the instance name YOURMACHINE\VSDOTNET. Reboot after installing.

Next, install the Northwind and Pubs databases by opening a DOS box and running the following osql commands:

osql E S COMPUTERNAME\VSDOTNET i "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO .NET\FRAMEWORKSDK\SAMPLES\SETUP\instpubs.sql"

and

osql E S COMPUTERNAME\VSDOTNET i "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO .NET\FRAMEWORKSDK\SAMPLES\SETUP\instnwnd.sql"

Replace COMPUTERNAME with the name of your computer, and keep the quotes. Note that there is a space between the 'Studio' and the '.NET'.

The SQL Server service manager will start by default, however it will not start the SQL Service itself by default. To configure the SQL Server Service Manager to automatically start when Windows starts up, open the service manager from your taskbar or from the startup folder within the start menu. Select 'SQL Server' from the 'Services' drop-down list and check the 'Auto-start service when OS starts' checkbox.

Reboot and you are ready to build a Web service that exposes this data.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date