I am trying to include two classes as members of another class in a
webservice. The definitions look basically like this:
Public Class clsLender
Public ID As String
Public Name As String
End Class
----------------------------------------------------------------------------------------
Namespace DataTypesVB.Enu merations
Public Class DefaultValues
Public Name As String
Public Lenders() As clsLender
End Class
End Namespace
Then the code looks like this:
<WebMethod()> Public Function GetDefaultValue s( ByVal some value As Guid) As
DataTypesVB.Enu merations.Defau ltValues
Dim i As Integer
Dim DefaultValues As New DataTypesVB.Enu merations.Defau ltValues()
With DefaultValues
.Name = some value
End With
For i = 0 To some number
With DefaultValues
ReDim Preserve .Lenders(i)
.Lenders(i).ID = some value
.Lenders(i).Nam e = some value
End With
Next i
Return DefaultValues
End Function
When I run this web service (quite a bit of code has been cut for
readability) I get the following error:
<faultstring>Se rver was unable to process request. --> Object reference not
set to an instance of an object.</faultstring>
Please help me understand where my failure is and how I can fix it. Thanks
in advance!
- Jeff
webservice. The definitions look basically like this:
Public Class clsLender
Public ID As String
Public Name As String
End Class
----------------------------------------------------------------------------------------
Namespace DataTypesVB.Enu merations
Public Class DefaultValues
Public Name As String
Public Lenders() As clsLender
End Class
End Namespace
Then the code looks like this:
<WebMethod()> Public Function GetDefaultValue s( ByVal some value As Guid) As
DataTypesVB.Enu merations.Defau ltValues
Dim i As Integer
Dim DefaultValues As New DataTypesVB.Enu merations.Defau ltValues()
With DefaultValues
.Name = some value
End With
For i = 0 To some number
With DefaultValues
ReDim Preserve .Lenders(i)
.Lenders(i).ID = some value
.Lenders(i).Nam e = some value
End With
Next i
Return DefaultValues
End Function
When I run this web service (quite a bit of code has been cut for
readability) I get the following error:
<faultstring>Se rver was unable to process request. --> Object reference not
set to an instance of an object.</faultstring>
Please help me understand where my failure is and how I can fix it. Thanks
in advance!
- Jeff
Comment