I receive the following error when I attempt to assign values to a web
service array.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
Source Error:
Line 553: AppDTO.zip = sZip
Line 554: AppDTO.dob = sDOB
'** line 555 is the highlighted row with the problem.
Line 555: AppDTO.questionAnswer(0).id = 1
Line 556: AppDTO.questionAnswer(0).answer(0).id = 1
Line 557: AppDTO.questionAnswer(0).answer(0).value = ""
---
the code snippet that is running is:
AppDTO = New localhost.ApplicationDTO
AppDTO.firstName = sFirstName
AppDTO.middleName = sMiddleName
AppDTO.lastName = sLastName
AppDTO.address1 = sAddress1
AppDTO.address2 = sAddress2
AppDTO.city = sCity
AppDTO.state = sState
AppDTO.zip = sZip
AppDTO.dob = sDOB
AppDTO.questionAnswer(0).id = 1
AppDTO.questionAnswer(0).answer(0).id = 1
AppDTO.questionAnswer(0).answer(0).value = ""
the secion of the WSDL that show the question answer array is:
<xsd:element type="stns:ArrayOfQuestionDTO"
name="questionAnswer"
minOccurs="1"
nillable="true"
maxOccurs="1">
</xsd:element>
the snippet of the class' generated from the WSDL are:"
<System.Xml.Serialization.SoapTypeAttribute("Answe rDTO",
"java:com.client.bus.apply.ws")> _
Public Class AnswerDTO
Public answer As String
Public id As Integer
Public value As String
End Class
<System.Xml.Serialization.SoapTypeAttribute("Quest ionDTO",
"java:com.client.bus.apply.ws")> _
Public Class QuestionDTO
Public answer() As AnswerDTO
Public id As Integer
Public question As String
End Class
<System.Xml.Serialization.SoapTypeAttribute("Appli cationDTO",
"java:com.client.bus.apply.ws")> _
'this only show a piece of this code
Public Class ApplicationDTO
Public address1 As String
Public address2 As String
Public city As String
Public dob As String
Public firstName As String
Public lastName As String
Public middleName As String
Public questionAnswer() As QuestionDTO
Public state As String
Public zip As String
End Class
Any thoughts on what I am doing wrong assigning these array values.