VB6 interop to .NET webservice client

I have generated a C# client .dll for a .NET webservice. I did this by adding a web reference in VS and edited the .cs file. I have added interfaces and attributes for COM interop. I have it registered on a Win2k machine and cannot access it with VB6. Of course VB6 Intellisense works fine (I'm assuming due to the interfaces). When I run the app, it pukes with 'ActiveX component can't create object'. I understand this to indicate a registry problem, but I've done many REGASM's and GACUTIL's.

I have seen many examples of VB6 to webservices, but they all use the MSSOAP3.0 toolkit. I have successfully accessed the webservice with the MSSOAP3.0 toolkit. Is it even possible to hack a VS generated webservice client .dll, and has anyone got an example?

[775 byte] By [tpollard] at [2008-3-5]
# 1

1) Make sure to first try to drop the dll or tlb into a COM+ server application to TEST the interop is set-up right

2) If that does not work, and COM+ then you are back to figuring out the RegAsm and SNK (I assume you already created a SNK key for the .Net proxy class)

3)If you are successful in setting up the COM+ application look in there to get the actual full class name to create the right object via VB6 (i.e CreateObject("Namespace.ClassName") ) Also look at the methods available insde the COMP+ application, if none of your methods area available you have not created the class interface which then create the instances of the serialized webmethods embeded in the proxy class generated via the webreference

4)delete the COM+ app, go to VB6and try to make an actual reference first to the tlb that was generated, if you do not have a tlb from the .Net proxy class... you need to create one via Regsvcs (Enterprised Services) or RegAsm

Like so:(replace getWSProxy with the name of your procy class dll)
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\RegSvcs /tlb:getWSProxy.tlb /appname:getWSProxy getWSProxy.dll

This will do steps 1-4... if it fails go and review the items above. I have done this many times,and I know it works... specially becasue I used it for clasic ASP on a WINNT server which can't host webservices or .Net web applications.
Good luck

J.C. at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Interop and Upgrade...
# 2

I wrote an article showing an easy way to call Web services from VB6. Basically, it's trivial to use Vb.NET to create a class that can call the Web service, but exposes itself as a COM object to VB6. Details here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/callwebsrvv6.asp

ScottSwigart-MVP at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Interop and Upgrade...
# 3

Thank you for taking the time to offer your solution. First thing this morning my boss suggested I add a class to expose to COM and call the proxy client. I did this and was successful. I have not yet had time to try your Enterprise Services COM+ solution but plan on making an attempt later as deadlines pass. Thanks again for your time. I do not take it for granted and I appreciate the effort...

...Tony

tpollard at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Interop and Upgrade...
# 4

Thank you for taking the time to respond. Yep, that's what I did. I just wrote another class to expose to COM between VB6 and the webservice proxy. Thanks again. Good article, wish I had read it last week..

...Tony

tpollard at 2007-8-31 > top of Msdn Tech,Visual Basic,Visual Basic Interop and Upgrade...