3

How can I create a VB6 client connect to WCF web service?

Is there any better solution to create web service instead of using WCF, so that it is lot more easier to connect from VB6?

kelvinfix
  • 2,915
  • 8
  • 37
  • 49

2 Answers2

11

It really depends on what your requirements are exactly. Here are some suggestions:

  1. You can write a .NET assembly that has a service reference to the WCF service, and have a wrapper class in that that isexposed as a COM object. You can access the VB6 web app from that. The only concern is what the app.config file would be called in this case. That is easy enough to find out via AppDomain.CurrentDomain.SetupInformation.ConfigurationFile as this stackoverflow answer illustrates. If your VB6 app is on the same LAN as your service this will have the advantage of allowing you to use netTcpBinding which would have less overhead than the http bindings. You could also get really exotic and use something like netMsmqBinding if you need disconnected access to the service.
  2. The deprecated Soap Toolkit 3.0 has a COM SOAP client. I would probably stick to basicHttpBinding if I was going to attempt to use that.
  3. If your service is relatively simple in the parameters it takes and the values it returns, you might want to consider using webHttpBinding, making raw http calls, and parsing the results yourself.
Community
  • 1
  • 1
Justin Dearing
  • 14,270
  • 22
  • 88
  • 161
2

You can find articles on writing a SOAP client in VB6 - such as this one

I would make some suggestions for you to look at alternative client or web-service technologies:

  1. Why go for a different web service technology in order to write the client in a 10 year old technology. I used to be a VB6 programmer, so I'm not anti it - but it seems a strange design choice to engineer a different service, for the purpose of using quite an old client technology. You must have your reasons, but I'd just like to challenge them a bit.
  2. I've written a WCF client application recently - using an auto-generated proxy in c# - worked fine. That said, a REST architecture for a web service is sometimes a little easier to understand and may be an alternative that would work better with VB6. Does your web service have to use a SOAP like architecture?

My recommendation is that if you are stuck with VB6 - and flexible for the web-service end - have a look at a REST architecture. If you want to go down the SOAP way - WCF has worked great for me, and you should be able to get something to work in VB6, but I would look for articles about using SOAP with VB6, as there will not be many about VB6 and WCF.

iandotkelly
  • 9,024
  • 8
  • 48
  • 67
  • 1. Existing software is still using VB6. – kelvinfix Aug 15 '11 at 01:22
  • I guessed that would be the case - but I don't know how modular your application would be, perhaps a VB.NET module to do the WCF bit? Don't know your application obviously, so this is just a suggestion. – iandotkelly Aug 15 '11 at 01:26