Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 16th, 2004, 08:19 AM
Registered User
 
Join Date: Jan 2004
Location: Hammond, LA, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Populating Dataset with Web Service

I'm relatively new with web services, and I have used web services that I have created from data in our own database up to now. However, I am attempting to pull data from an external source.

The web service is located at http://www.webservicex.net/icd9.asmx. I have used the Web Reference wizzard to add it as a service. I've named it RefICD9.

I have a simple datagrid to hold the info, and in the Load Event I have:
  If Not Page.IsPostBack Then
   Dim ws As New HDCApps.RefICD9.ICD9
   Dim ICD91 As New DataSet(ws.GetICD9Level1())
   Dim dvICD91 As New DataView(ICD91.Tables(0))
   dgICD91.DataSource = dvICD91
   dgICD91.DataBind()
  End If

Simple. However, it returns an error:

Exception Details: System.IndexOutOfRangeException: Cannot find table 0.

In Debugger, if I stop the program just before defining the dataview, the dataset, ICD91 DataSetName contains the following (the entire return), but it obviously isn't converted to a table, it remains a string:

DataSetName "<NewDataSet>
 <Table>
  <ICD9Level1ID>2</ICD9Level1ID>
  <ICD9Code>140-239</ICD9Code>
  <ICD9Description>02. Neoplasms</ICD9Description>
 </Table>

[some omitted for length]

 <Table>
  <ICD9Level1ID>18</ICD9Level1ID>
  <ICD9Code>E-Codes</ICD9Code>
  <ICD9Description>Supplementary classification of external causes of injury and poisoning</ICD9Description>
 </Table>
</NewDataSet>" String

I think the problem is that there isn't a schema with the data. Is that right?

If so, what is the remedy?

Thanks,
Joe
Reply With Quote
  #2 (permalink)  
Old July 16th, 2004, 01:33 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I would have to agree with you on that one.

I looked at the WSDL for it, and I see that all the responses are strings instead of a dataset or datatable. This seems like a poor technique. As you have found, I don't think you'll be able to create a dataset from those strings because of the lack of the schema. You will probably have to read that string into an XML object and query the XML instead.
Reply With Quote
  #3 (permalink)  
Old July 16th, 2004, 03:29 PM
Registered User
 
Join Date: Jan 2004
Location: Hammond, LA, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How practical would it be to create local schema(s) for this datastream? Is it possible to provide a schema where one doesn't exist? Would it change how .NET returns the data (hopefully in a dataset with a nice table)?

Joe
Reply With Quote
  #4 (permalink)  
Old July 18th, 2004, 02:36 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Well, if you know and/or can predict the schema for the data that is coming back in this string, then you could presumably tack on the schema part to this returned string to form a correctly "serialized" dataset which you could then actually cast into a dataset object. However, if the returned data string changed, then you'd run into problems. But I guess no more problems than if the service returned a regular dataset and the table structure changed so I suppose it's just as succeptable to problems.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
populating a db table with a sql dataset(full) helloise C# 0 August 26th, 2008 08:54 AM
Web Service Consuming another web service CraigWhitfield EJB 0 January 10th, 2008 07:38 AM
Create a DataSet in a Web Service amirdiwan C# 2005 1 February 22nd, 2007 03:52 PM
Service Oriented Web Service aldwinenriquez .NET Web Services 2 September 15th, 2005 03:25 AM
rebind dataset from web service after click button blur_ivy .NET Web Services 2 April 15th, 2005 09:09 AM



All times are GMT -4. The time now is 12:58 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.