Solved

bind web service response to grid view

Posted on 2011-03-07
6
1,027 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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
API v SOA 8 39
FInd Image Control Gridview 3 35
PowerShell:  Column widths won't expand 3 49
I need help changing the default value for an @HTML.LabelFor control 4 36
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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…

756 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