invalidcastexception

  • Thread starter Thread starter imonline
  • Start date Start date
I

imonline

Hi,
I have developed a webservice with OTA compliance using WSCF 0.6.
Now eveything works fine but the soap messages with paymentcard node is
giving me following error.

(70, 29). ---> System.InvalidCastException: Operator '<>'
is not defined for 'Nothing'
and type 'PaymentCardType'

Please let me know what am I doing wrong.

Regards,
Nis
 
I have developed a webservice with OTA compliance using WSCF 0.6.
Now eveything works fine but the soap messages with paymentcard node is
giving me following error.

(70, 29). ---> System.InvalidCastException: Operator '<>'
is not defined for 'Nothing'
and type 'PaymentCardType'

Please let me know what am I doing wrong.

Without seeing your code (sigh...) it's a little difficult to tell, but it
looks as though you are either HTMLEncoding / URLEncoding when you shouldn't
or not HTMLDecoding / URLEncoding when you should...

Either that or your webservice is not returning a value in a node where the
caller is expecting to find a value...
 
Hey Mark,
Thanks for your reply. Let me know which code do you
wanna see. Let me explain you the whole scenario. I have created my
webservice using wscf 0.6 using XSDs. The webservice works fine with
almost all messages. But Some of the messages which contain paymentcard
gives the error as given in my first mail. If I remove that node the
service works fine.

Let me know which code you want to review.

Thanks,
Nis
 
Somewhere you have a piece of code that does

x <> y

where y is a variable of type PaymentCardType and x is of type
Nothing....and VB doesn't know how to compare nothing to PaymentCardType.

You should probably check X for nothing before moving on...

Karl
 
Hey Karl,
Thanks a lot for reply and throwing some light on the
issue. The inner exception indicates the following code as problematic;
<System.Xml.Serialization.XmlElementAttribute("BankAcct",
GetType(BankAcctType), Order:=0), _
System.Xml.Serialization.XmlElementAttribute("Cash",
GetType(PaymentFormTypeCash), Order:=0), _
System.Xml.Serialization.XmlElementAttribute("DirectBill",
GetType(DirectBillType), Order:=0), _

System.Xml.Serialization.XmlElementAttribute("LoyaltyRedemption",
GetType(PaymentFormTypeLoyaltyRedemption), Order:=0), _

System.Xml.Serialization.XmlElementAttribute("MiscChargeOrder",
GetType(PaymentFormTypeMiscChargeOrder), Order:=0), _
System.Xml.Serialization.XmlElementAttribute("PaymentCard",
GetType(PaymentCardType), Order:=0), _
System.Xml.Serialization.XmlElementAttribute("Voucher",
GetType(PaymentFormTypeVoucher), Order:=0)> _
Public Property Item() As Object
Get
Return Me._item
End Get
Set
If (Me._item <> value) Then
Me._item = value
End If
End Set
End Property

Can u tell me what am I doing Wrong?

Thanks,
Nis
 
Back
Top