Solved

bind web service response to grid view

Posted on 2011-03-07
6
1,034 Views
Last Modified: 2013-12-17
I have a webservice that I am connecting to and receiving a response in xml format. How can I bind this response to a data grid view?

wsdl link

any help would be greatly appreciated.

Cheers,
Brendan
PartnerService partnerService = new PartnerService();
            EMSystems_HaveBed.com.emsystem.test.getUpdate requestArguement = new EMSystems_HaveBed.com.emsystem.test.getUpdate();
            EMSystems_HaveBed.com.emsystem.test.getUpdateResponse updateResponse = default(EMSystems_HaveBed.com.emsystem.test.getUpdateResponse);

            partnerService.Credentials = new NetworkCredential("user", "password");
            partnerService.PreAuthenticate = true;

            try
            {
                requestArguement.String_1 = "<?xml version='1.0'?><requestDefinition actionName='getHAvBEDStatus' systemName='EMResource' divisionName='1821'></requestDefinition>";
                updateResponse = partnerService.getUpdate(requestArguement);

                txtResult.Text = updateResponse.result.ToString();
            }
            catch(Exception ex)
            {
                txtResult.Text = ex.Message.ToString();

Open in new window

get-response.xml
0
Comment
Question by:brendanlefavre
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35085416
I would think that you could use an XmlDataSource, which would be configured to load the XML, and then bind to the GridView with the DataSourceID property.
0
 

Author Comment

by:brendanlefavre
ID: 35150273
how can I bind the XMLDataSource to the response from the web service?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 35150755
The XmlDataSource.Data property is used to load a string into the data source:

XmlDataSource.Data Property
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.xmldatasource.data.aspx#Y499
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
LVL 3

Assisted Solution

by:kumarnimavat
kumarnimavat earned 250 total points
ID: 35166272
0
 

Author Comment

by:brendanlefavre
ID: 35201370
I have been looking over the last sample, and have a couple questions.

-There is a reference to a database, but the database doesn't exist. Do I need to create a database for the sample to work?

-On line 33 of the default.aspx.cs
      byte[] buf = System.Text.ASCIIEncoding.ASCII.GetBytes(neNode.OuterXml);

Open in new window


when i run the code, I get an error "Object reference not set to an instance of an object"


- I am trying to figure out how I can take the output of the web service call, and apply it using the sample. I understand how they bind the xml document to the grid view, but I'm not seeing how to take the web service response and do the same.

Cheers,
Brendan
0
 

Author Closing Comment

by:brendanlefavre
ID: 35366649
Thank you for all of your help. I have realized that it is a bit more complicated than just binding directly to the web service. I am going to do some more research, and then give this another try.

Cheers,
Brendan
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

636 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