troubleshooting Question

read value from xmlnode returned by web service

Avatar of dobbinjp
dobbinjp asked on
2 Comments1 Solution644 ViewsLast Modified:
I have developed a web service that accepts an input code and returns data as an XMLnode. The format of the returned XMLnode is attached. I can read the entire returned xmlnode and bind it to a gridview with my attached code. However, I need to be able to read the individual values and my code doesn't seem to work where I am trying to display one particular value as a label (I get null reference exceptions). The web service is located at the following location:

The service is "getprevandnext" and to use it pass a value of "19I0065001" to see what is returned.

If there is a better way to read this data than my current code, please advise.

Thanks for your help!!
'returned data format below
'here is my code, everything works except where noted (Label 4 text)
        Dim consumewebservice As New edu.vanderbilt.vuse.transp2.Service
        Dim reader As XmlNodeReader
        Dim ds As New DataSet()
        Dim wsNode As XmlNode
        wsNode = consumewebservice.GetPrevandNext("19I0065001")
        'the following line does not work
        Label4.Text = wsNode.Attributes("PreviousID").Value.ToString
        reader = New XmlNodeReader(wsNode)
        GridView1.DataSource = ds.Tables("Data")
        GridView1.AutoGenerateColumns = True

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros