5

I have a VB6 application that I want to communicate with a WCF Windows Service that I have written which imports Security Certificates. The only function in the service takes two string arguments. I have been having a lot of difficulty getting the two programs to communicate however.

In VB.NET, it is easy, just make a reference to the service as you would a web service. In VB6, however, it is not so simple it seems. Searching only seems to pull up examples of how to WRITE a Windows service in VB6.

Anyone know how this is done?

CodeWarrior
  • 7,388
  • 7
  • 51
  • 78
  • Do you know http://social.msdn.microsoft.com/Forums/pl-PL/wcf/thread/d5c5ab13-bf07-4047-8be7-c697f8f4c564 and http://www.vbforums.com/showthread.php?t=558239 ? – kroonwijk Sep 30 '11 at 20:16
  • Yeah I saw variations of both of those. I have tried using the SOAP toolkit, without success. I could not figure out how to get the wsdl generated at runtime (ala ServiceModelSamples/service.svc?wsdl) and the wcf wsdl that is generated when you run svcutil does not have everything necessary to connect. They seem to be geared specifically to webservices (even though I have communicated with the windows service in this case almost exactly as I have with webservices)... – CodeWarrior Sep 30 '11 at 20:30
  • .Net WCF is not really very interoperable with other Web Services toolkits in general. A search of the Web for "WCF interoperability" helps reveal the real story. – Bob77 Sep 30 '11 at 22:41
  • @BobRiemersma: that's nonsense if not backed up by facts. – John Saunders Nov 28 '12 at 01:34

1 Answers1

11

The easyest way I have found to access a WCF service from VB6 is to create a .Net ComObject wrapper for the service client. Then in VB6 all your are doing is a create object and calling some methods on the object. All the WCF work takes place in the .Net com object.

user957902
  • 3,010
  • 14
  • 18
  • Sounds intriguing. How is that done? I have never done it before. – CodeWarrior Sep 30 '11 at 20:18
  • Simply create the WCF client to the service in a separate project [as described in this link.](http://www.west-wind.com/weblog/posts/2007/Dec/16/WCF-Clients-and-COM-Interop) [Register the .NET assembly](http://blogs.msdn.com/b/jigarme/archive/2008/04/28/how-to-register-net-assembly-for-com-interop.aspx) as a type library which you would then link from the VB6 app. – Sixto Saez Sep 30 '11 at 20:30
  • So then VB6 app will call the client, which will in turn call the service? In that case, I think I will just put the services functionality in the registered assembly and skip a step. Honestly I thought this would have been easier. – CodeWarrior Oct 03 '11 at 15:04