invalidcastexception

Discussion in 'ASP .Net' started by imonline, Dec 11, 2006.

  1. imonline

    imonline Guest

    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
     
    imonline, Dec 11, 2006
    #1
    1. Advertising

  2. imonline

    Mark Rae Guest

    "imonline" <> wrote in message
    news:...

    > 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). ---&gt; System.InvalidCastException: Operator '&lt;&gt;'
    > 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...
     
    Mark Rae, Dec 11, 2006
    #2
    1. Advertising

  3. imonline

    imonline Guest

    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
    Mark Rae wrote:
    > "imonline" <> wrote in message
    > news:...
    >
    > > 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). ---&gt; System.InvalidCastException: Operator '&lt;&gt;'
    > > 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...
     
    imonline, Dec 11, 2006
    #3
  4. imonline

    Karl Seguin Guest

    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

    --
    http://www.openmymind.net/
    http://www.fuelindustries.com/


    "imonline" <> wrote in message
    news:...
    > 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). ---&gt; System.InvalidCastException: Operator '&lt;&gt;'
    > is not defined for 'Nothing'
    > and type 'PaymentCardType'
    >
    > Please let me know what am I doing wrong.
    >
    > Regards,
    > Nis
    >
     
    Karl Seguin, Dec 11, 2006
    #4
  5. imonline

    imonline Guest

    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
    Karl Seguin wrote:
    > 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
    >
    > --
    > http://www.openmymind.net/
    > http://www.fuelindustries.com/
    >
    >
    > "imonline" <> wrote in message
    > news:...
    > > 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). ---&gt; System.InvalidCastException: Operator '&lt;&gt;'
    > > is not defined for 'Nothing'
    > > and type 'PaymentCardType'
    > >
    > > Please let me know what am I doing wrong.
    > >
    > > Regards,
    > > Nis
    > >
     
    imonline, Dec 11, 2006
    #5
  6. imonline

    imonline Guest

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


    Regards,
    Nis
    Ciaran O''Donnell wrote:
    > --> Me._item <> value
    > one of these is null, probably the member variable considering this is
    > deserialising,
    > try changing it to:
    > --> Me._item Is Nothing OrElse Me._item <> value
    >
    > --
    > Ciaran O''''Donnell
    > http://wannabedeveloper.spaces.live.com
    >
    >
    > "imonline" wrote:
    >
    > > 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
    > > Karl Seguin wrote:
    > > > 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
    > > >
    > > > --
    > > > http://www.openmymind.net/
    > > > http://www.fuelindustries.com/
    > > >
    > > >
    > > > "imonline" <> wrote in message
    > > > news:...
    > > > > 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
    > > > >

    > >
    > >
     
    imonline, Dec 12, 2006
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ajit
    Replies:
    1
    Views:
    3,640
    Victor Garcia Aprea [MVP]
    Apr 24, 2004
  2. Floela
    Replies:
    3
    Views:
    582
    Jon Skeet
    Jul 10, 2003
  3. Arjen
    Replies:
    1
    Views:
    7,780
    Carl Prothman [MVP]
    Aug 6, 2003
  4. Miguel Angel Dinelli
    Replies:
    1
    Views:
    453
    Chris Jackson
    Nov 13, 2003
  5. Roy Lawson
    Replies:
    12
    Views:
    5,222
Loading...

Share This Page