Friday, July 21, 2006

Using SOAP Tool Kit 3.0 with VB Programs

Connecting to a webservice from a .NET desktop application is a piece of cake. But what about connecting to a webservice within unmanaged code - VB6/C++ programs? Actually SAOP Tool kit is the soultion. It is a Microsoft Tool used for calling webservices from unmanaged code.
You can download the kit from the Microsoft Official website:

http://www.microsoft.com/downloads/details.aspx?familyid=c943c0dd-ceec-4088-9753-86f052ec8450&displaylang=en

Here is a code snippt to call a webservice form inside VB6 program:



Dim soap As New SoapClient30
Dim serverURL as String
Dim hashCode as string

On Error GoTo ConnectionError

Public Sub WebServiceConnect

'Set Server URL
serverURL = "http://localhost/MyServiceName/Service.asmx?wsdl"

'Client is initialized
soap.MSSoapInit serverURL

'Calling the webservice
hashCode = soap.wsAuthenticate(txtUsername.Text, txtPassword.Text)

Exit Sub

ConnectionError:

MsgBox "Connection Error Encountered"

Exit Sub

The tool now is in its third version. Micorsoft declared that the SOAP tool kit 3.0 will not be supported after 31st March, 2008 because of the next generation of the Microsoft softwares will be .NET based. There will be no need to use SAOP tool kit as VS.NET gives already the ability to connect easily to webservices from the .NET desktop programs.

0 comments: