Groups | Blog | Home
all groups > dotnet web services > august 2006 >

dotnet web services : Web Service Returning Data Best Practice


Anthony Biondo Jr
8/23/2006 10:51:59 AM
I am trying to figure out the best way to return data through a web service.
If the value is a single value I can just set it equal to the web service
name. If I am returning a set of data I have seen a couple ways to do this.
The dataset coming back to me is a SybaseASE Data Reader. Any help you can
provide would be much appreciated.

thanks,
Anthony

Right now I have done the following:

Namespace MedicaidEligibilityService

Public Class Result
Public MemberID As String
Public SSN As String
Public DOB As String
Public MemberFirstName As String
Public MemberLastName As String
Public MemberAddress1 As String
Public MemberAddress2 As String
Public MemberAddress3 As String
Public MemberCity As String
Public MemberState As String
Public MemberZipCode As String
Public MemberPhone As String
Public PhysicianName As String
Public PhysicianPhone As String
Public ReturnCode As String
Public ReturnDescription As String
Public EligibilityDate As String
End Class

I get the dataset back and set each field to a local variable and do the
following

Dim myResult As MedicaidEligibilityService.Result
myResult = New MedicaidEligibilityService.Result
myResult.MemberID = Out_MemberID.Trim
myResult.SSN = Out_SSN.Trim
myResult.DOB = Out_DOB.Trim
myResult.MemberFirstName = Out_MemberFirstName.Trim
myResult.MemberLastName = Out_MemberLastName.Trim
myResult.MemberAddress1 = Out_MemberAddress1.Trim
myResult.MemberAddress2 = Out_MemberAddress2.Trim
myResult.MemberAddress3 = Out_MemberAddress3.Trim
myResult.MemberCity = Out_MemberCity.Trim
myResult.MemberState = Out_MemberState.Trim
myResult.MemberZipCode = Out_MemberZipCode.Trim
myResult.MemberPhone = Out_MemberPhone.Trim
myResult.PhysicianName = Out_PhysicianName.Trim
myResult.PhysicianPhone = Out_PhysicianPhone.Trim
myResult.ReturnCode = Out_ReturnCode.Trim
myResult.ReturnDescription =
BuildReturnDescription(Out_ReturnCode)
myResult.EligibilityDate = Out_EligibilityDate.Trim
Return myResult

Gaurav Vaish (www.EduJini.IN)
8/23/2006 11:07:13 PM
Hi Anthony,

[quoted text, click to view]

Setting it equat to the web-service name? How do you that? ;-)

Well, I don't think that would be possible... at least as of now in
..net. But I may be wrong since I slept last night :)

[quoted text, click to view]

DataSet cannot be serialized (to XML in SOAP based Web Services). You
will need to put it into a DataView and then it may be directly sent over
the channel.



--
Happy Hacking,
Gaurav Vaish | http://www.mastergaurav.org
http://www.edujini.in | http://webservices.edujini.in
-------------------

linhardt NO[at]SPAM aol.com
8/24/2006 3:29:40 PM
What I do is pack all the data in a dataset and then return it be
reference. I use the function return just to signal if the data read
was successful or not.

You should make sure that the DS is cleared before calling so that you
don't bother sending a big dataset to the web service which isn't used
anyway.

The web reference on the client side takes care of marshalling and
demarshalling the data sent by reference back into the original
client's dataset. It's actually kind of amazing that Call By Reference
works completely transparently with web services.

Friend Function dbGetDS(ByVal KeyID As Integer, ByRef DS As DataSet) As
RETCODE

-paul


[quoted text, click to view]
AddThis Social Bookmark Button