which way to return struc from webservice?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cj2

    which way to return struc from webservice?

    Which function shows the proper way to return this structure
    Validate, Validate2, or Validate3? And a short why would be nice.

    Public Class Validate
    Inherits System.Web.Serv ices.WebService

    Public Structure ValResult
    Dim mResponse As String
    Dim mReason As String
    End Structure

    <WebMethod()_
    Public Function Validate(ByVal ibtn As String, ByVal irequestor As
    String)
    Dim thisResult As New ValResult
    thisResult.mRes ponse = "ALLOW"
    thisResult.mRea son = "Good"
    Return thisResult
    End Function

    <WebMethod()_
    Public Function Validate2(ByVal ibtn As String, ByVal
    irequestor As String) As ValResult
    Validate2.mResp onse = "ALLOW"
    Validate2.mReas on = "Good"
    Return Validate2
    End Function

    <WebMethod()_
    Public Function Validate3(ByVal ibtn As String, ByVal irequestor As
    String) As ValResult
    Dim thisResult As New ValResult
    thisResult.mRes ponse = "ALLOW"
    thisResult.mRea son = "Good"
    Return thisResult
    End Function
    End Class
  • Family Tree Mike

    #2
    Re: which way to return struc from webservice?

    "cj2" <cj2@nospam.nos pamwrote in message
    news:eRB3jl$SJH A.588@TK2MSFTNG P06.phx.gbl...
    Which function shows the proper way to return this structure
    Validate, Validate2, or Validate3? And a short why would be nice.
    >
    Public Class Validate
    Inherits System.Web.Serv ices.WebService
    >
    Public Structure ValResult
    Dim mResponse As String
    Dim mReason As String
    End Structure
    >
    <WebMethod()_
    Public Function Validate(ByVal ibtn As String, ByVal irequestor As
    String)
    Dim thisResult As New ValResult
    thisResult.mRes ponse = "ALLOW"
    thisResult.mRea son = "Good"
    Return thisResult
    End Function
    >
    <WebMethod()_
    Public Function Validate2(ByVal ibtn As String, ByVal irequestor
    As String) As ValResult
    Validate2.mResp onse = "ALLOW"
    Validate2.mReas on = "Good"
    Return Validate2
    End Function
    >
    <WebMethod()_
    Public Function Validate3(ByVal ibtn As String, ByVal irequestor As
    String) As ValResult
    Dim thisResult As New ValResult
    thisResult.mRes ponse = "ALLOW"
    thisResult.mRea son = "Good"
    Return thisResult
    End Function
    End Class

    Validate3 is my choice, because I hate the other two.

    Validate does not convey a return type. Validate2 does the work in a very
    vb6 way in that the function name is treated as the return variable.

    Comment

    Working...