COM+ component giving wierd error in WebService

D

Daryl Davis

I had this working once apon a time before my code was obliterated....

This is a simple dll hosted on a server that goes to a database and returns
the next available number.
I am wrapping it into a webservice so that I can use handheld devices.
the error I get is
Run-time exception thrown : System.NullReferenceException - Object reference
not set to an instance of an object.

when I call the function.

if I set ref = hallcallermain.clscallermain the error is

"System.InvalidCastException: Specified cast is not valid.

when it try's to create object.

any ideas? (code below)


<WebMethod(Description:="Goes to server and returns next available number")>
_

Public Overridable Function GetNextComNumber() As Integer

Dim ref As Object

Try

ref = CreateObject("hallcallermain.clscallermain", "\\192.168.10.254")

Catch ex As Exception

Return 0

End Try

Return ref.GetNextComNumber

End Function
 
M

Michelle Hlaing

--------------------
From: "Daryl Davis" <[email protected]>
Subject: COM+ component giving wierd error in WebService
Date: Wed, 9 Jun 2004 10:47:59 -0700
I had this working once apon a time before my code was obliterated....

This is a simple dll hosted on a server that goes to a database and returns
the next available number.
I am wrapping it into a webservice so that I can use handheld devices.
the error I get is
Run-time exception thrown : System.NullReferenceException - Object reference
not set to an instance of an object.

when I call the function.

if I set ref = hallcallermain.clscallermain the error is

"System.InvalidCastException: Specified cast is not valid.

when it try's to create object.

any ideas? (code below)


<WebMethod(Description:="Goes to server and returns next available number")>
_

Public Overridable Function GetNextComNumber() As Integer

Dim ref As Object

Try

ref = CreateObject("hallcallermain.clscallermain", "\\192.168.10.254")

Catch ex As Exception

Return 0

End Try

Return ref.GetNextComNumber

End Function
You definitely are referencing a null object somewhere. you might want to double check that CreateObject actually created a non-null object.
hallcallermain.clscallermain might be null hence assigning it to ref throws an Invalid cast.

regards,

Michelle

***Disclaimer: This posting is provided "as is" with no warranties and confers no rights.***
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top