Microsoft Knowledge Base Email Alertz

KBAlertz.com: (305965) - 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 Download and install the SOAP Toolkit from the following...

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **


Bug Tracking Software
For bug tracking software or defect tracking software or issue tracking software, visit Axosoft.


Community Site



We Send hundreds of thousands of emails using ASP.NET Email



Expert Web Design & Graphic Design
Design44.com

ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
The ad says 3 - but KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 305965 - Last Review: September 30, 2003 - Revision: 3.1

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

This article was previously published under Q305965

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 (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.


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
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please