Calling a Web Service using VB6 with SOAP 3.0 - Example 2: Calling a ColdFusion web service
(Page 3 of 4 )
In this example the same web service is called, but with the New construct. In order to use SOAP 3.0 with this method, you should access the Microsoft SOAP Type Library 3.0, which adds the MSSOAP30.dll (the version used in this tutorial is 3.0.1325.0) . You can access this by going to Project-->References from the main menu. If you do not see this, then you will have to download it from the Microsoft website. It is also installed with Office 2003 (Office 11). Sometimes you may have to browse if it is located in another path with the Browse...button.

With the type library added you can access the various objects, methods and events in the object browser as shown. It has many classes as shown here, of which the class of interest at present is the SoapClient30.

If you forgot to add this reference and tried to run the code, you would get a compiler error message as follows:

To form1 of a new project, add a button and a text box after adding the reference. Now review the code for calling the service shown below, added to the click event.
Private Sub Command1_Click()
Dim clnt As New SoapClient30
Dim strsvc As String
clnt.MSSoapInit "http://localhost/CF_WebSvc/justFunction.cfc?wsdl"
strsvc = clnt.WelcomeMsg(Text1.Text)
MsgBox (strsvc)
End Sub
Because you have established a reference you get the advantage of intellisense, and as you type in the code you get the cue to the appropriate property, method, or event to choose. Now if you execute the above code, you get the same kind of reply as before, since nothing else has changed.
Next: Example 3: SOAP client calling the Enc/Denc web service >>
More Visual Basic.NET Articles
More By Jayaram Krishnaswamy
|
| · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | | |
|