UnderSeven
asked on
Object not set to instance error when trying to instance object.
Here is my code
The last line is throwing the object refernce not set error.
This is the object definition:
Dim objXMLHTTP As New MSXML2.ServerXMLHTTP60()
Dim service As New pconWSService.pconWSService
Dim response As New pconWSService.InitiateSessionTransferResponse
Dim initiatePublicSessionTransferRequest As New pconWSService.InitiatePublicSessionTransferRequest
initiatePublicSessionTransferRequest.parameters(0) = New pconWSService.Parameter With {.name = "StatementNo", .value = Session.Item("curStatement")}
The last line is throwing the object refernce not set error.
This is the object definition:
Partial Public Class Parameter
Private nameField As String
Private valueField As String
'''<remarks/>
Public Property name() As String
Get
Return Me.nameField
End Get
Set
Me.nameField = value
End Set
End Property
ASKER
Here is the entire class. For the sake of simplicity I've hard coded that value,
initiatePublicSessionTrans ferRequest .parameter s(0) = New pconWSService.Parameter With {.name = "StatementNo", .value = "1"}
initiatePublicSessionTrans
Partial Public Class Parameter
Private nameField As String
Private valueField As String
'''<remarks/>
Public Property name() As String
Get
Return Me.nameField
End Get
Set
Me.nameField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(IsNullable:=true)> _
Public Property value() As String
Get
Return Me.valueField
End Get
Set
Me.valueField = value
End Set
End Property
End Class
In the initiatePublicSessionTrans ferRequest object has the parameters array been created and initialized?
ASKER
It's part of the initiatepublictransferrequ est class. I thought, here is that definition.
I assumed I was missing something obvious.
I assumed I was missing something obvious.
Partial Public Class InitiatePublicSessionTransferRequest
Private billerGroupIdField As String
Private billerIdField As String
Private productCodeField As String
Private billerPayorIdField As String
Private amountDueField As System.Nullable(Of Decimal)
Private amountDueTbdField As Boolean
Private dueDateField As System.Nullable(Of Date)
Private dueDateTbdField As Boolean
Private level2SalesTaxAmountField As System.Nullable(Of Decimal)
Private level2CustomerReferenceNumberField As String
Private userIdField As String
Private localeField As String
Private parametersField() As Parameter
Private disallowLoginField As System.Nullable(Of Boolean)
Private returnSessionIdField As String
Private returnUrlField As String
'''<remarks/>
Public Property billerGroupId() As String
Get
Return Me.billerGroupIdField
End Get
Set
Me.billerGroupIdField = value
End Set
End Property
'''<remarks/>
Public Property billerId() As String
Get
Return Me.billerIdField
End Get
Set
Me.billerIdField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(IsNullable:=true)> _
Public Property productCode() As String
Get
Return Me.productCodeField
End Get
Set
Me.productCodeField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(IsNullable:=true)> _
Public Property billerPayorId() As String
Get
Return Me.billerPayorIdField
End Get
Set
Me.billerPayorIdField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(IsNullable:=true)> _
Public Property amountDue() As System.Nullable(Of Decimal)
Get
Return Me.amountDueField
End Get
Set
Me.amountDueField = value
End Set
End Property
'''<remarks/>
Public Property amountDueTbd() As Boolean
Get
Return Me.amountDueTbdField
End Get
Set
Me.amountDueTbdField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(DataType:="date", IsNullable:=true)> _
Public Property dueDate() As System.Nullable(Of Date)
Get
Return Me.dueDateField
End Get
Set
Me.dueDateField = value
End Set
End Property
'''<remarks/>
Public Property dueDateTbd() As Boolean
Get
Return Me.dueDateTbdField
End Get
Set
Me.dueDateTbdField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(IsNullable:=true)> _
Public Property level2SalesTaxAmount() As System.Nullable(Of Decimal)
Get
Return Me.level2SalesTaxAmountField
End Get
Set
Me.level2SalesTaxAmountField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(IsNullable:=true)> _
Public Property level2CustomerReferenceNumber() As String
Get
Return Me.level2CustomerReferenceNumberField
End Get
Set
Me.level2CustomerReferenceNumberField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(IsNullable:=true)> _
Public Property userId() As String
Get
Return Me.userIdField
End Get
Set
Me.userIdField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(IsNullable:=true)> _
Public Property locale() As String
Get
Return Me.localeField
End Get
Set
Me.localeField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlArrayAttribute(IsNullable:=true), _
System.Xml.Serialization.XmlArrayItemAttribute("parameter", IsNullable:=false)> _
Public Property parameters() As Parameter()
Get
Return Me.parametersField
End Get
Set
Me.parametersField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(IsNullable:=true)> _
Public Property disallowLogin() As System.Nullable(Of Boolean)
Get
Return Me.disallowLoginField
End Get
Set
Me.disallowLoginField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(IsNullable:=true)> _
Public Property returnSessionId() As String
Get
Return Me.returnSessionIdField
End Get
Set
Me.returnSessionIdField = value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(IsNullable:=true)> _
Public Property returnUrl() As String
Get
Return Me.returnUrlField
End Get
Set
Me.returnUrlField = value
End Set
End Property
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Wouldn't this in theory instantiate the array:
Dim initiatePublicSessionTrans ferRequest .parameter s() as pconWSService.Parameter
initiatePublicSessionTrans ferRequest .parameter s = New pconWSService.Parameter() With {.name = "StatementNo", .value = Session.Item("curStatement ")}
But it is tellig me exepecting end of statement on the dim statement and on the latter statement that it can't convert pconWSService.parameter() to a one dimiensional array.
I'm still confused what I'm doing wrong.
Dim initiatePublicSessionTrans
initiatePublicSessionTrans
But it is tellig me exepecting end of statement on the dim statement and on the latter statement that it can't convert pconWSService.parameter() to a one dimiensional array.
I'm still confused what I'm doing wrong.
On what line are you getting the exception? Please also post the exception and inner exception messages.
ASKER
Dim initiatePublicSessionTrans ferRequest .parameters() as InitiatePublicSessionTrans ferRequest .parameter s
First bolded: end of statement expected
It won't compile at this poitn so I can't give inner exceptions.
First bolded: end of statement expected
It won't compile at this poitn so I can't give inner exceptions.
ASKER
This is the solution. More or less what you said it would be.
Dim initiatePublicSessionTrans ferRequest As pconWSService.InitiatePubl icSessionT ransferReq uest = New pconWSService.InitiatePubl icSessionT ransferReq uest
Dim paramfields(0) As pconWSService.Parameter
paramfields(0) = New pconWSService.Parameter With {.name = "StatementNo", .value = Session.Item("curStatement ")}
initiatePublicSessionTrans ferRequest .parameter s = paramfields
Dim initiatePublicSessionTrans
Dim paramfields(0) As pconWSService.Parameter
paramfields(0) = New pconWSService.Parameter With {.name = "StatementNo", .value = Session.Item("curStatement
initiatePublicSessionTrans
Where is the rest of the Parameter class?
Are you sure that you have a value in Session.Item("curStatement