Consume Web Service

Posted on 2007-10-10
Last Modified: 2013-11-07
Hello, I'm trying to consume a web service located here:
I have added the reference and am trying to get it to display the information properly. Curently I'm attempting to databind the information obtained in a gridview control with:

Dim stockquote As net.webservicex.www.StockQuote

            stockquote = New net.webservicex.www.StockQuote

            gvStockQuote.DataSource = stockquote.GetQuote("DELL")


This does bind the data to the gridview but each character is displayed on it's own line in the same column. How can I display it better? It is to view the current company stock data.
Question by:gogetsome
    LVL 7

    Expert Comment

    by:Abu Hamdan
    You should use XSD to format these xml into typed dataset and then pass the created dataset to the grid
    Read more on this subject:

    Author Comment

    Thanks hammdan for your replay. I read what I could understand from your link and am trying this:

      Dim stockquote As net.webservicex.www.StockQuote

                stockquote = New net.webservicex.www.StockQuote

                Dim ds As DataSet = New DataSet
                ds.ReadXml(stockquote.GetQuote("BBOX"), XmlReadMode.Auto)

                gvStockQuote.DataSource = ds


    it is throwing the following error:
    Illegal characters in path

    What am I doing wrong?
    LVL 7

    Accepted Solution


    Author Comment

    WOW! Thanks hammdan! Great find.

    Naturally it is in c# and I work in VB. I have a conversion utility but it is failing at this particular conversion. The points are yours for sure, but would it be too much to ask for help in the conversion?

            //Create a StockQuote Object
            StockQuote s = new StockQuote(txtSymbol.Text);

            //Get the RawXml
            txtQuote.Text = s.RawXml;

            //Display the contents of the Quote's Parameters
            lblNVC.Text = string.Empty;
            foreach (string key in s.Parameters.Keys)
                lblNVC.Text += key + " --> " + s.Parameters[key] + "<br/>";

            //Display selected parameters
            lblSymbol.Text = s.Symbol;
            lblLast.Text = s.Last;
            lblChange.Text = s.Change;
            lblAt.Text = s.QuoteDateTime.ToString("MMM dd yyyy HH:mm");

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now