Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

bind web service response to grid view

Posted on 2011-03-07
6
Medium Priority
?
1,042 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 1000 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
Vim Reference Guide

Vim is a powerful text editor favored by many sysadmins and developers - here are some commands that you'll want to keep in your back pocket!

 
LVL 3

Assisted Solution

by:kumarnimavat
kumarnimavat earned 1000 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

PowerShell Core for Advanced Linux Administrators

Understand advanced principals around Powershell Core with a focus on the Linux Administrator.  This course covers how to administer numerous environments across multiple platforms including Linux, Azure, AWS, and Google Cloud from a single shell instance.

Question has a verified solution.

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

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

721 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