What could cause "Object reference not set to an instance of an object." error? I was trying to read the envelope table. I got the code from the 3rd link below.
http://www.e-topco.com/oa/oa_help/OpenAir_SOAP.ht m
http://www.e-topco.com/oa/oa_help/Complex_Types/Intro_Complex_T ypes.htm
http://www.e-topco.com/oa/oa_help/Code_Examples/Code_Examples.h tm
Here is the code I am using
http://www.e-topco.com/oa/oa_help/OpenAir_SOAP.ht m
http://www.e-topco.com/oa/oa_help/Complex_Types/Intro_Complex_T ypes.htm
http://www.e-topco.com/oa/oa_help/Code_Examples/Code_Examples.h tm
Here is the code I am using
Code:
Private Sub btnProject2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProject2.Click
Dim stub As New com.openair.sandbox.OAirServiceHandlerService()
Dim req As New ReadRequest()
req.type = "Envelope"
req.method = "all"
Dim env1 As New oaEnvelope
req.objects = New oaEnvelope() {env1}
Try
Dim results As ReadResult() = m_svc.read(New ReadRequest() {req})
' iterate through our results and output them to console
For Each result As ReadResult In results
' output any errors
If result.errors IsNot Nothing Then
For Each err As oaError In result.errors
MessageBox.Show("Error " + err.code + ": " + err.comment + "" & Chr(9) & "" + err.text)
Next
End If
' output the envelope read results
If result.objects IsNot Nothing Then
MessageBox.Show("Received " + result.objects.Length + " envelope(s) from OpenAir")
For Each env As oaEnvelope In result.objects
MessageBox.Show(Chr(9) & "" + env.id + env.total + env.date + env.name + env.tottickets)
Next
End If
Next
Catch ex As Exception
MessageBox.Show("Error while reading envelopes:" & Chr(10) & "" & ex.Message)
End Try
End Sub
Comment