J
Jeff Cobelli
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.Enumerations
Public Class DefaultValues
Public Name As String
Public Lenders() As clsLender
End Class
End Namespace
Then the code looks like this:
<WebMethod()> Public Function GetDefaultValues( ByVal some value As Guid) As
DataTypesVB.Enumerations.DefaultValues
Dim i As Integer
Dim DefaultValues As New DataTypesVB.Enumerations.DefaultValues()
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).Name = 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>Server 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.Enumerations
Public Class DefaultValues
Public Name As String
Public Lenders() As clsLender
End Class
End Namespace
Then the code looks like this:
<WebMethod()> Public Function GetDefaultValues( ByVal some value As Guid) As
DataTypesVB.Enumerations.DefaultValues
Dim i As Integer
Dim DefaultValues As New DataTypesVB.Enumerations.DefaultValues()
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).Name = 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>Server 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