StockTickerComplete
Running the StockTickerComplete example produces the test page shown in Figure 15-10.
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 ...
Get Programming ASP.NET, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.