HOW TO: Consume XML Web Service Methods by Using SOAP Toolkit 2.0

Article translations Article translations
Article ID: 305965 - View products that this article applies to.
This article was previously published under Q305965
Expand all | Collapse all

On This Page

SUMMARY

This step-by-step article describes how to make simple calls to an XML Web service by using Simple Object Access Protocol (SOAP) Toolkit version 2.0.

Create an Application in Visual Basic

  1. Download and install the SOAP Toolkit from the following Microsoft Developer Network (MSDN) Web site:
    http://msdn.microsoft.com/en-us/library/aa286526.aspx
    This includes downloads for the Toolkit, the Toolkit samples, and a merge module for redistributing the underlying objects that you can include with the setup program for your application.
  2. Make a local copy of the Web Services Description Language (WSDL) file.NOTE: Although this step is not required, you should make a copy on your local computer. It is possible to specify the URL for the WSDL on the remote server, but it can be more convenient to copy the file locally.

  3. : Although this step is not required, you should make a copy on your local computer. It is possible to specify the URL for the WSDL on the remote server, but it can be more convenient to copy the file locally.In your Visual Basic project, add a reference to the Microsoft SOAP Type Library. To do this, select References on the Project menu, and then be sure that Microsoft Soap Type Library is selected in the list. Click OK.
  4. : Although this step is not required, you should make a copy on your local computer. It is possible to specify the URL for the WSDL on the remote server, but it can be more convenient to copy the file locally.Create an instance of the SoapClient object, as follows:
    Dim oSoapClient As New MSSOAPLib.SoapClient
    					
  5. : Although this step is not required, you should make a copy on your local computer. It is possible to specify the URL for the WSDL on the remote server, but it can be more convenient to copy the file locally.Initialize the SoapClient object with the WSDL file that you copied in Step 2 by using the mssoapinit method, as follows:
    oSoapClient.mssoapinit "C:\CLIENTWSDLS\CALC.WSDL", "Calc", "CalcSoapPort"
    						
    The first parameter is the path to the WSDL file. The second parameter is the value of the name attribute for the service element in the WSDL file that corresponds to the XML Web service that you want to call. The third parameter is the port type for the service element that corresponds to the XML Web service that you want to call. This parameter indicates the type of connection that will be made to the XML Web service.
  6. : Although this step is not required, you should make a copy on your local computer. It is possible to specify the URL for the WSDL on the remote server, but it can be more convenient to copy the file locally.Call the XML Web service method by using the SoapClient object as if it were a method that is exposed by the SoapClient object itself. For example, if you attempt to call an XML Web service method called Add that takes two integers as parameters, your code may resemble the following:
    Dim Sum As Integer
    Sum = oSoapClient.Add(3, 4)
    					
  7. : Although this step is not required, you should make a copy on your local computer. It is possible to specify the URL for the WSDL on the remote server, but it can be more convenient to copy the file locally.Build and run the program.

Troubleshooting

If the methods require complex parameters, you may need to handle them differently. For more information, see the "Handling Complex Types" topic in the online documentation for SOAP Toolkit 2.0.

Properties

Article ID: 305965 - Last Review: September 30, 2003 - Revision: 3.2
APPLIES TO
  • Microsoft Visual Basic Enterprise Edition for Windows 6.0
  • Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 5
  • Microsoft XML Core Services 4.0
  • Microsoft SOAP Toolkit 2.0
Keywords: 
kbhowto kbhowtomaster KB305965

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com