webservice系列教学(9)-如何调用webservice(vb6.0,vbscript)

4.8使用vb6.0调用
需下载msSoapToolkit20.exe
添加引用:Microsoft Soap Type Library
位置:”C:\Program Files\Common Files\MSSoap\Binaries\ MSSOAP1.dll”
    调用方法:
    Dim cc As New MSSOAPLib.SoapClient
    例程:
    新建工程标准EXE添加3个textbox控件,text1,text2,text3添加一个button控件Command1
    代码如下:
    Option Explicit
Dim cc As New MSSOAPLib.SoapClient
Private Sub Command1_Click()
cc.mssoapinit "http://192.168.0.4/yundan/Service1.asmx?WSDL"
Me.Text3.Text = cc.test(CInt(Text1.Text), CInt(Text2.Text))
End Sub
4.9使用vbscript调用
需下载msSoapToolkit20.exe
引用:MSSOAP.SoapClient
    例程:
Option Explicit
Const WSDL_URL = "http://192.168.0.4/yundan/service1.wsdl"
WScript.echo "Connecting: " & WSDL_URL
Dim Calc
Set Calc = CreateObject("MSSOAP.SoapClient")
Calc.mssoapinit WSDL_URL
Dim Answer
Answer = Calc.test(14,28)
WScript.Echo "14+28=" & Answer
将其存成domo.vbs文件,直接双击运行。

你可能感兴趣的:(webservice)