Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Receiving arbitary 2-dimensional tables in a WebService method

Reply
Thread Tools

Receiving arbitary 2-dimensional tables in a WebService method

 
 
George Vlahakis
Guest
Posts: n/a
 
      06-27-2006
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
 
 
 
 
Dale
Guest
Posts: n/a
 
      07-08-2006
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...-from-web.html

HTH

Dale
--
Dale Preston
MCAD C#
MCSE, MCDBA


"George Vlahakis" wrote:

> 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

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting an arbitary date the *RIGHT* way Aryeh M. Friedman Java 6 01-23-2009 03:08 PM
Asynchronous Call of WebService method within a WebService RenÚ Preu▀ler ASP .Net Web Services 0 10-29-2008 11:55 AM
Not Receiving Results from Java Webservice Eric ASP .Net Web Services 3 07-28-2004 08:36 PM
Arbitary VTABLE/Python John Smith Python 2 05-04-2004 05:55 PM
Freezing an arbitary object Aryeh M. Frierdman Ruby 8 07-07-2003 08:08 AM



Advertisments