Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / May 2005

Tip: Looking for answers? Try searching our database.

assigning values to a web service array

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ryoung - 24 May 2005 17:43 GMT
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("AnswerDTO",
"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("QuestionDTO",
"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("ApplicationDTO",
"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.
Ziga Jakhel - 31 May 2005 10:24 GMT
Most likely the questionAnswer array is empty. Check the length!

Regards,

Sigmund Jakhel

>I receive the following error when I attempt to assign values to a web
> service array.
[quoted text clipped - 68 lines]
>
> Any thoughts on what I am doing wrong assigning these array values.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.