C#
  Home arrow C# arrow Build a C# Stock Quote WebService Part 1/2
IBM developerWorks
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C#

Build a C# Stock Quote WebService Part 1/2
By: Peter Bromberg
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 9
    2003-01-06

    Table of Contents:
  • Build a C# Stock Quote WebService Part 1/2
  • Building the Ticker
  • Building the Ticker (cont'd)
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Build a C# Stock Quote WebService Part 1/2


    (Page 1 of 4 )

    Peter Bromberg of EggheadCafe.com discusses how to build a C# stock ticker using XML Web Services.Spring is almost here, and it's time to create .NET stuff! So, building on my article of last year, "Build a Custom Stock Quote Component", I decided it would be a fun exercise to "stretch my skills" a bit and build a new one, but this time -- to do it in C# as a full-fledged .NET WebService. And, since Microsoft has been nice enough to give away a WebService Behavior HTC that can be "plugged in" to a DHTML web page to act as a webservice consumer, I thought that would be an elegant finishing touch to show an example of building a consumer Web page for my new StockQuote class.

    We'll deal with getting the WebService built and running in this installment, and in Part II, we review how to use the WebService DHTML Behavior in a regular client-side .htm page to consume the WebService. (The downloadable code link at the bottom of this article, however, contains ALL the code, 'cause I know how you hate to wait for people's "multiple part' articles!) In Part II, I'll get into some neat client-side stuff, so visit often.

    On a side note, If you're in a quandary about DOT NET and you aren't sure whether to stay with VB6 or go to VB7 or start with C#, my advice is -- after a great deal of agonizing study and thought -- conserve all the extra time you can find, DROP EVERYTHING, and get started with C#.

    Forget VBScript (its already a dinosaur) as well as VB6 and even Javascript. Microsoft has over a million lines of C# code in the .NET platform - those guys are eating, breathing, sleeping and everything else in C#. And unlike their brethren at Oracle and Sun, they've submitted it to the ECMA for certification.

    In sum, C# is an elegant, simple, and powerful programming language that you're almost certain to see on other platforms while the Java guys who are still too busy bashing the guys in Redmond to see what's comin' at-em on the turnpike at 100 miles an hour will likely be wondering what happened.

    In this article, we're going to walk through the Webservice C# code first, and then we'll take a look at the DHTML page and how the WebService Behavior can be used to easily wire up the page to act as a webservice consumer.

    While this is a pretty simple class with only one method, "GetQuote" it still demonstrates some important techniques- handling and parsing multiple stock symbols as input parameters, utilizing the WebRequestFactory class, as well as the StreamReader and StringBuilder .NET classes to parse and clean up the response stream and process the return values.

    Finally, we'll build a valid XML return document that the WebService returns to the calling client, as well some simple error -handling code.

    More C# Articles
    More By Peter Bromberg


     

    C# ARTICLES

    - Introduction to Objects and Classes in C#, P...
    - Visual C#.NET, Part 1: Introduction to Progr...
    - C# - An Introduction
    - Hotmail Exposed: Access Hotmail using C#
    - Razor Sharp C#
    - Introduction to Objects and Classes in C#
    - Making Your Code CLS Compliant
    - Programming with MySQL and .NET Technologies
    - Socket Programming in C# - Part II
    - Socket Programming in C# - Part I
    - Creational Patterns in C#
    - Type Conversions
    - Creating Custom Delegates and Events in C#
    - Inheritance and Polymorphism
    - Understanding Properties in C#







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway