Use VB to call WebService

Source: Internet
Author: User
Keywords: VB, WebService, C #, debugging environment: VB6 + SP5, 2005, soap Toolkit 3.0 to call WebService in VB, you must first install soap toolkit, can download to Microsoft's website, for: Familyid = BA611554-5943-444C-B53C-C0A450B7013C & displaylang = en

1. First, use to create a WebService project and add the following debugging code:

Public String helloworld (){
Return "Hello World ";
} [Webmethod]
Public int add (int x, int y)
Return X + Y;

2. Create a VB project and add references to the soap Toolkit (Microsoft soap Type Library 3.0)

3. Add the following code to VB:

Private sub commandementclick ()
Dim soapclient as new soapclient30
Dim text as string

'Note: This is the local WebService address, which may vary in actual applications.

Soapclient. mssoapinit "http: // localhost: 2239/demowebservice/service. asmx? WSDL"

TEXT = soapclient. helloworld 'write the server method name directly here
Msgbox text

Dim total as integer

Total = soapclient. Add (2, 3)

Msgbox total
End sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.