O'Reilly logo

Programming ASP.NET, 3rd Edition by Dan Hurwitz, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

StockTickerComplete

Running the StockTickerComplete example produces the test page shown in Figure 15-10.

StockTickerComplete

Figure 15-10. StockTickerComplete

The complete source code for the code-behind file, App_Code/Service.cs, is listed in Example 15-18. The code is included here to show how all the snippets of code presented fit together.

Example 15-18. Service.cs—StockTickerComplete code-behind file

using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System; // necesary for String class using System.EnterpriseServices; // necessary for transactions using System.Collections; // necssary for ArrayLists using System.Data; // necessary for DataSet using System.Data.SqlClient; // necessary for DataSet [WebService(Description = "A stock ticker using C#.", Name = "StockTicker", Namespace = "www.LibertyAssociates.com")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1, EmitConformanceClaims = true)] [WebServiceBinding(Name = "OverloadedGetValue", ConformsTo = WsiProfiles.BasicProfile1_1, EmitConformanceClaims = true)] public class Service : System.Web.Services.WebService { // Construct and fill an array of stock symbols and prices. // Note: the stock prices are as of 5/1/05. string[,] stocks = { {"MSFT","Microsoft","25.30"}, {"DELL","Dell Computers","34.83"}, {"HPQ","Hewlett Packard","20.47"}, {"YHOO","Yahoo!","34.50"}, {"GE","General Electric","36.20"}, {"IBM","International ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required