VB6.0 调用webservice问题求助
各位老师,我有VB6.0 调用webservice实现发短信功能,只发送一条时不报错,发送多条时就会报错,下面是我的代码:
单条短信发送代码如下:(可以正常发送短信)
Option Explicit
Dim soapclient As New MSSOAPLib30.SoapClient30
Private Sub Command1_Click()
Dim str
soapclient.MSSoapInit "http://16.1.30.9:809/service1.asmx?wsdl", "", "", ""
str = soapclient.SendSmsByPicc("用户名", "密码", 手机号, "2233", "", 22366555)
End Sub
我条短信测试代码如下:
Option Explicit
Dim soapclient As New MSSOAPLib30.SoapClient30
Private Sub Command1_Click()
Dim str
dim i
i=1
for i=1 to 3
soapclient.MSSoapInit "http://16.1.30.9:809/service1.asmx?wsdl", "", "", ""
str = soapclient.SendSmsByPicc("用户名", "密码", 手机号, "2233", "", 22366555)
next
End Sub
这样一执行的话,能收以一条短信,但是紧接着就报错,错误信息如下:
实时错误 '-2147024811 (80070055)':
Client:soap client is already initialized.
HRSEULT=0x80070055:本地设备已在使用中
我用ASP写了一个调用webservice 的程序,可以实现循环发送,
主要代码如下:
for i=0 to ubound(mobiles)
Set xmldoc = server.createObject("Msxml2.DOMDocument")
xmldoc.async = false
Set soapclient = server.CreateObject("MSSOAP.SoapClient30")
soapclient.ClientProperty("ServerHTTPRequest") = True
soapclient.mssoapinit "http://16.1.30.9:809/service1.asmx?wsdl", "", "", ""
str = soapclient.SendSmsByPicc(login_name,password,mobiles(i),message,start_time,Search_ID)
next
直是百思不得其解,
我在网上找到几个方法,把
soapclient.ClientProperty("timeout") = 10000
加入到代码里,但是提示:timeout 不可识别,
希望各位老师能解答一下,万分感谢
--------------------编程问答-------------------- 你试试在循环中Dim soapclient As New MSSOAPLib30.SoapClient30呢
并且发送完毕就释放它
补充:VB , API