assigning values to a web service array

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ryoung

    assigning values to a web service array

    I receive the following error when I attempt to assign values to a web
    service array.

    Exception Details: System.NullRefe renceException: 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.question Answer(0).id = 1
    Line 556: AppDTO.question Answer(0).answe r(0).id = 1
    Line 557: AppDTO.question Answer(0).answe r(0).value = ""
    ---

    the code snippet that is running is:
    AppDTO = New localhost.Appli cationDTO
    AppDTO.firstNam e = sFirstName
    AppDTO.middleNa me = sMiddleName
    AppDTO.lastName = sLastName
    AppDTO.address1 = sAddress1
    AppDTO.address2 = sAddress2
    AppDTO.city = sCity
    AppDTO.state = sState
    AppDTO.zip = sZip
    AppDTO.dob = sDOB
    AppDTO.question Answer(0).id = 1
    AppDTO.question Answer(0).answe r(0).id = 1
    AppDTO.question Answer(0).answe r(0).value = ""

    the secion of the WSDL that show the question answer array is:
    <xsd:element type="stns:Arra yOfQuestionDTO"
    name="questionA nswer"
    minOccurs="1"
    nillable="true"
    maxOccurs="1">
    </xsd:element>

    the snippet of the class' generated from the WSDL are:"
    <System.Xml.Ser ialization.Soap TypeAttribute(" AnswerDTO",
    "java:com.clien t.bus.apply.ws" )> _
    Public Class AnswerDTO
    Public answer As String
    Public id As Integer
    Public value As String
    End Class

    <System.Xml.Ser ialization.Soap TypeAttribute(" QuestionDTO",
    "java:com.clien t.bus.apply.ws" )> _
    Public Class QuestionDTO
    Public answer() As AnswerDTO
    Public id As Integer
    Public question As String
    End Class

    <System.Xml.Ser ialization.Soap TypeAttribute(" ApplicationDTO" ,
    "java:com.clien t.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.

Working...