• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

Consume Web Service

Hello, I'm trying to consume a web service located here: http://www.webservicex.net/stockquote.asmx
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")

            gvStockQuote.DataBind()

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.
0
gogetsome
Asked:
gogetsome
  • 2
  • 2
1 Solution
 
Abu HamdanEnterprise Architect, PM ExpertCommented:
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:
http://msdn2.microsoft.com/en-us/library/fx29c3yd(VS.80).aspx
0
 
gogetsomeAuthor Commented:
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

            gvStockQuote.DataBind()


it is throwing the following error:
Illegal characters in path


What am I doing wrong?
0
 
Abu HamdanEnterprise Architect, PM ExpertCommented:
0
 
gogetsomeAuthor Commented:
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");
    }
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now