Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
|
.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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 16th, 2004, 08:19 AM
Registered User
 
Join Date: Jan 2004
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
 
Old July 16th, 2004, 01:33 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
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.
 
Old July 16th, 2004, 03:29 PM
Registered User
 
Join Date: Jan 2004
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
 
Old July 18th, 2004, 02:36 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
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.





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 08:38 AM
Create a DataSet in a Web Service amirdiwan C# 2005 1 February 22nd, 2007 04: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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.