|
|
|
start date: Fri, 17 Aug 2007 10:14:02 -0700,
posted on: microsoft.public.dotnet.framework.webservices
back
| Thread Index |
|
1
AlBruAn .(donotspam)
|
|
2
John Saunders [MVP] john.saunders at trizetto.com
|
|
3
unknown
|
|
4
AlBruAn .(donotspam)
|
Web Service doesn't return needed values
I've also posted this at dotnet.framework.aspnet.webservices, but here goes
anyway ...
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?
Date:Fri, 17 Aug 2007 10:14:02 -0700
Author:
|
Re: Web Service doesn't return needed values
"AlBruAn" <albruan@hotmail.com.(donotspam)> wrote in message
news:29FD8DE2-567E-472B-A1FF-67995719C03D@microsoft.com...
> I've also posted this at dotnet.framework.aspnet.webservices, but here
> goes
> anyway ...
>
> 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:
The only thing I can think of is that you should declare your
RetrieveFieldNames function as AvailableFields().
--
John Saunders [MVP]
Date:Fri, 17 Aug 2007 13:29:03 -0400
Author:
|
Re: Web Service doesn't return needed values
On Aug 17, 12:14 pm, AlBruAn <albr...@hotmail.com.(donotspam)> wrote:
> I've also posted this at dotnet.framework.aspnet.webservices, but here goes
> anyway ...
>
> 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?
As a test, try creating a default constructor for AvailableFields that
does not take any parameters, and also change the public properties to
have a Set accessor. May not be the problem, but may be worth a try.
Ron
Date:Sat, 18 Aug 2007 09:48:20 -0700
Author:
|
RE: Web Service doesn't return needed values
Thanks to both of you!
Date:Mon, 20 Aug 2007 06:20:05 -0700
Author:
|
|
|