Solved

bind web service response to grid view

Posted on 2011-03-07
6
1,019 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
  • 3
  • 2
6 Comments
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
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
Comment Utility
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
Comment Utility
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
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

 
LVL 3

Assisted Solution

by:kumarnimavat
kumarnimavat earned 250 total points
Comment Utility
0
 

Author Comment

by:brendanlefavre
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 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

13 Experts available now in Live!

Get 1:1 Help Now