HighTechTalks DotNet Forums  

Receiving arbitary 2-dimensional tables in a WebService method

ASP.net Web Services microsoft.public.dotnet.framework.aspnet.webservices


Discuss Receiving arbitary 2-dimensional tables in a WebService method in the ASP.net Web Services forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
George Vlahakis
 
Posts: n/a

Default Receiving arbitary 2-dimensional tables in a WebService method - 06-27-2006 , 03:15 PM






To put simply:

I have a WebMethod I wish to be able to accept arbitary two-dimensional
tables generated from any client (not .NET only). I have in fact gone down
the path of creating a custom "ImportRequest" class which in effect has some
header information and then follows with the columns and rows of the table
that needs to be imported.

I do not need the table to conform to any specific schema as the database
table will be created on the fly, but I DO need to know the types for each
column. I thought of using some sort of enumeration for describe the type
but everytime I look at the issue again I keep getting the feeling I am
re-inventing the wheel.

It would be good if in my "ImportRequest" I could somehow have the type
embedded so that a table lets say :

<Counsil>
<Name>
Berkshire
</Name>
<Population>
89,098
</Population>
<SurveyDate>
01/01/2006
</SurveyDate>
</Council>

so I could (on the receiving side) determine that <Population> is a numeric
and that <SurveyDate> is a date.

Here is a sample of what I wish to do:

<WebMethod> Public Function ImportData( request As ImportRequest ) as
ImportResponse
...
End Function

Public Class ImportRequest
Public CustomerID As Long
Public Name As String
Public Description As String
Public Columns() As Column
Public Rows() As Row
End Class

Public Enum ColumnType
Text
Numeric
End Enum

Public Class Column
Public ColumnName As String
Public ColumnType As ColumnType
End Class

Public Class Row
Public Values() As String
End Class

The goal is to receive the "Values" and convert them to a specified type. I
tried using the DataSet and it also consumed XML with String types for
everything unless I used a Schema on the client side. The later I suspect
will be a bit too much to ask from the client to do so I am hoping that the
Value types can somehow be embedded in the XML ImportRequest.

Thanks in advance

George



Reply With Quote
  #2  
Old   
Dale
 
Posts: n/a

Default RE: Receiving arbitary 2-dimensional tables in a WebService method - 07-08-2006 , 01:54 PM






You could return objects that contain the value as an object and the name of
the type of the value as a string. You would still have to use a class
factory or at least a case statement on the client to get the right type but
at least you'd know what type was returned.

To return objects from your webservice, look at my series at
http://www.dalepreston.com/Blog/2005/02/returning-custom-classes-from-web.html

HTH

Dale
--
Dale Preston
MCAD C#
MCSE, MCDBA


"George Vlahakis" wrote:

Quote:
To put simply:

I have a WebMethod I wish to be able to accept arbitary two-dimensional
tables generated from any client (not .NET only). I have in fact gone down
the path of creating a custom "ImportRequest" class which in effect has some
header information and then follows with the columns and rows of the table
that needs to be imported.

I do not need the table to conform to any specific schema as the database
table will be created on the fly, but I DO need to know the types for each
column. I thought of using some sort of enumeration for describe the type
but everytime I look at the issue again I keep getting the feeling I am
re-inventing the wheel.

It would be good if in my "ImportRequest" I could somehow have the type
embedded so that a table lets say :

Counsil
Name
Berkshire
/Name
Population
89,098
/Population
SurveyDate
01/01/2006
/SurveyDate
/Council

so I could (on the receiving side) determine that <Population> is a numeric
and that <SurveyDate> is a date.

Here is a sample of what I wish to do:

WebMethod> Public Function ImportData( request As ImportRequest ) as
ImportResponse
...
End Function

Public Class ImportRequest
Public CustomerID As Long
Public Name As String
Public Description As String
Public Columns() As Column
Public Rows() As Row
End Class

Public Enum ColumnType
Text
Numeric
End Enum

Public Class Column
Public ColumnName As String
Public ColumnType As ColumnType
End Class

Public Class Row
Public Values() As String
End Class

The goal is to receive the "Values" and convert them to a specified type. I
tried using the DataSet and it also consumed XML with String types for
everything unless I used a Schema on the client side. The later I suspect
will be a bit too much to ask from the client to do so I am hoping that the
Value types can somehow be embedded in the XML ImportRequest.

Thanks in advance

George




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.