Calling a .NET assembly from VB6
Today, after beating my head against a wall for two days straight, I managed to break through.
the scenario: A client uses data from various sources, much of it
extracted from web pages using a not-too-dumb spider program that I
wrote. One of the sources rewrote their entire site in ASP.NET,
which is exceedingly difficult to spider (particularly when the
WebForms use the “isPostBack” property to handle processing logic;
suffice it to say that it's nearly impossible to spider). The
contact at for the source said “Oh, no problem, everything you need is
accessible as a WebService over SOAP!”.
Turns out that
SOAP isn't always as simple as we'd like it to be, particularly when
the documentation is sparse and the site was designed to handle
multiple “flavors” (it's not worth explaining, but their implementation
uses custom SOAP Headers in the envelope, and even with a Header
Handler, I wasn't able to get the SOAP Toolkit to work properly).
working in VB6, rather than VB.NET, so the solution was somewhat less
than trivial. But with a little nudge in the right direction I
finally figured it out. I managed to build a .NET assembly to
interact with the Web Service, and wrap it in COM Interop so that I
could call it from VB6. And then, easy-peasey-lemon-squeezie, I
got my results.
If you're trying to call a SOAP Web Service from VB6, do yourself a favor and read this tutorial from gotdotnet.com.
It'll walk you through the process of building a .NET COM server.
Oh, and use Visual Studio.NET to build a suitable client module
(The wsdl utility will spit out a lovely SOAP client for you).