invalidcastexception

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
 
M

Mark Rae

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...
 
I

imonline

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
 
K

Karl Seguin

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
 
I

imonline

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
 
I

imonline

Thanks a lot Ciaran for the solution. Your suggestion has solved my
problem.


Regards,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top