Unable to instantiate .NET assembly in VBScript (COM Interop)

man_25

New member
Joined
Jun 1, 2007
Messages
1
Programming Experience
3-5
I have a DLL or assembly that I created in .NET that calls a webservice. I registered this as a COM Interop using regasm. I then opended the registry to check the objects and saw that one of the proxy classes that is part of the webservice I am connecting to has an entry in the registry like so -

[HKEY_CLASSES_ROOT\WebserviceModule.WebReference.customer_profile]
@="WebserviceModule.WebReference.customer_profile"

i.e. to create an object in VBScript I refer to the ProgID as -

Set CProfile =
CreateObject("WebserviceModule.WebReference.customer_profile")
................
WScript.StdOut.WriteLine "Last Name:" & CProfile.LastName

My problem is that the above line works but if I try to get the "Last Name" value of this class in in ASP -

Set CProfile =
Server.CreateObject("WebserviceModule.WebReference.customer_profile")
..............
Response.write CProfile.LastName

it gives me error:

Error Type: Microsoft VBScript runtime (0x800A01A8) Object required: WebserviceModule.WebReferenc'
/site/test1.asp, line 17

The error is not at the "Server.CreateObject" line but when I call a value of this 'CProfile' class. If I comment the "Response.write CProfile.LastName" line it works, but if I try to retrieve the value it gives me the error above.


Any idea whyis this so? Am I creating the object properly? And am I retrieving the value properly too? It works in VBScript after all.


FYI
WebserviceModule - My .NET Project namespace WebReference - The Proxy class for the webservice that I am calling customer_profile - One of the classes of the webservice proxy
 
believe it or not the object is not being create as the CreateObject() call. CreateObject() will return Nothing and assign that to you variable which is valid from the compilers point of view. The program only knows there's a problem when you try to access the property of a null object, Nothing. I'd guess that your service is not installed correctly but I'm not too sure about services. Have you read up on the MSDN?
 
Back
Top