Call WebService with VB

xiaoxiao2021-03-30  202

Keywords: VB, WebService, C #,

Debug environment: VB6 SP5, VS.NET 2005, SOAP Toolkit 3.0

In VB, call WebService to first install SOAP Toolkit, you can download on Microsoft's website, download address is:

Http://www.microsoft.com/downloads/details.aspx?familyid=ba611554-5943-444c-b53c-5943-444c-b53c- 2550b7013c&displayLANG=EN

1 First use vs.net to establish a WebService project, add the following debug code

[WebMethod]

Public string helloworld () {

Return "Hello World";

}

[WebMethod]

Public Int Add (int X, int y)

{

Return X Y;

}

2 New VB project to add a reference to SOAP Toolkit (Microsoft SOAP TYPE LIBRARY 3.0)

3 Add the following code in VB:

Private Sub Command1_Click () Dim SoapClient AS New SoapClient30 Dim Text As String

'Note: This is a local WebService address, there will be different applications in practical applications.

SOAPCLIENT.MSSOAPINIT "http: // localhost: 2239 / demowebservice / service.asmx? WSDL"

Text = soapclient.helloWorld 'Direct Writing Direct Method of Msgbox Text Dim Total As Integer Total = SOAPCLIENT.ADD (2, 3) Msgbox Totalend Sub

转载请注明原文地址:https://www.9cbs.com/read-130724.html

New Post(0)