Web Service doesn't return needed values

Discussion in 'ASP .Net Web Services' started by AlBruAn, Aug 17, 2007.

  1. AlBruAn

    AlBruAn Guest

    I'm having to use a Web Service to populate a control via JavaScript, but I
    can't quite seem to get the Web Service to return the needed values. My web
    method is as follows:

    <WebMethod()> _
    Public Function RetrieveAvailableTemplateFields(ByVal entityTypeID As
    Integer, _
    ByVal processID As Integer) As AvailableFields()

    Return AvailableFields.RetrieveFieldNames(entityTypeID, processID)

    End Function

    The class containing the function it calls is defined as follows:

    <Serializable()> _
    Public Class AvailableFields

    Private _FieldName As String
    Private _FieldTag As String 'essentially the same as FieldName

    Private Shared _ConnString As String = _
    ConfigurationManager.ConnectionStrings("FROMain").ConnectionString

    Public ReadOnly Property FieldName() As String
    Get
    Return _FieldName
    End Get
    End Property

    Public ReadOnly Property FieldTag() As String
    Get
    Return _FieldTag
    End Get
    End Property

    Public Sub New()

    End Sub

    Public Sub New(ByVal fieldName As String, ByVal fieldTag As String)
    _FieldName = fieldName
    _FieldTag = fieldTag
    End Sub

    Public Shared Function RetrieveFieldNames(ByVal entityTypeID As Integer,
    ByVal processID As Integer)
    Dim fieldList As New Generic.List(Of AvailableFields)
    Dim info As New AvailableFields()

    Dim dr As SqlDataReader = SqlDataAccess.ExecuteReader(_ConnString, _
    "Outbound.RetrieveTemplateFieldsByEntityTypeAndProcessIDs", _
    entityTypeID, processID)

    While dr.Read()
    info = New AvailableFields(dr("FieldName"), dr("FieldTag"))
    fieldList.Add(info)
    End While

    If dr IsNot Nothing Then
    dr.Close()
    End If

    Return fieldList.ToArray()

    End Function
    End Class


    When I try invoking the Web Service, I get the following XML returned:

    <?xml version="1.0" encoding="utf-8" ?>
    - <ArrayOfAvailableFields
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://yourname.com/">
    <AvailableFields />
    <AvailableFields />
    <AvailableFields />
    <AvailableFields />
    <AvailableFields />
    <AvailableFields />
    </ArrayOfAvailableFields>


    What am I doing wrong that's keeping me from getting back the names and tags
    of the available fields?
     
    AlBruAn, Aug 17, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Greenhorn
    Replies:
    15
    Views:
    847
    Keith Thompson
    Mar 6, 2005
  2. scottrm

    how return list values from web service

    scottrm, Jan 5, 2005, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    361
    Erymuzuan Mustapa
    Jan 5, 2005
  3. Shawn Cutter

    Return multiple values from web service

    Shawn Cutter, Jun 9, 2005, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    294
  4. DonaldN
    Replies:
    1
    Views:
    565
    Josh Twist
    Feb 17, 2006
  5. Leo Violette
    Replies:
    0
    Views:
    1,068
    Leo Violette
    Apr 17, 2009
Loading...

Share This Page