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?
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
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