Keywords: VB, WebService, C #, debugging environment: VB6 + SP5, vs.net 2005, soap Toolkit 3.0 to call WebService in VB, you must first install soap toolkit, can download to Microsoft's website, for: http://www.microsoft.com/downloads/details.aspx? Familyid = BA611554-5943-444C-B53C-C0A450B7013C & displaylang = en
1. First, use vs.net to create a WebService project and add the following debugging code:
[Webmethod]
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