当前位置: 首页 > 短信SDK > VB短信SDK
VB短信SDK
<短信管理.My.MySettings> 短信管理.My.MySettings> http://sdk.entinfo.cn:8060/webservice.asmx
二、查询短信余额Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
参数名称 |
说明 |
备注 |
Sn |
软件序列号 |
格式XXX-XXX-XXX-XXXXX |
Pwd |
密码 |
md5(sn+password) 32位大写 密文 +表示连接 |
函数返回值:String(余额)
接口地址:http://sdk.entinfo.cn:8060/webservice.asmx?op=balance
示例:序列号SDK-SSD-010-00001 密码 xxxxxx
参数输入:
SN= SDK-SSD-010-00001
PWD= 3B5D3C427365F40C1D27682D78BB31E0
示例返回结果: 余额79109条短信
XML格式:
具体函数VB实现:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim SMS As New sdk2.WebService Dim sn$ = TextBox1.Text.Trim Dim pwd$ = TextBox2.Text.Trim pwd$ = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sn$ & pwd$, "MD5") If sn = "" Then MsgBox("需要输入序列号") Exit Sub End If If pwd = "" Then MsgBox("需要输入序列号密码") Exit Sub End If TextBox5.Text = "余额数:" + SMS.balance(sn, pwd) End Sub
三、普通群发发送短信Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
参数名称 |
说明 |
是否必须 |
备注 |
Sn |
软件序列号 |
是 |
格式XXX-XXX-XXX-XXXXX |
Pwd |
密码 |
是 |
md5(sn+password) 32位大写密文 |
Mobile |
手机号 |
是 |
必填(支持10000个手机号,建议<=5000)多个英文逗号隔开 |
Content |
内容 |
是 |
支持长短信(详细请看长短信扣费说明) |
Ext |
扩展码 |
否 |
例如:123(默认置空) |
stime |
定时时间 |
否 |
例如:2010-12-29 16:27:03(非定时置空) |
Rrid |
唯一标识 |
否 |
最长18位,只能是数字或者 字母 或者数字+字母的组合 |
函数返回值:String(唯一标识,即当前发送短信批次的唯一标识,和rrid对应,如为空则返回系统生成的rrid),此方法推荐用于大量群发.内容相同手机号多个的情况。
接口地址:http://sdk.entinfo.cn:8060/webservice.asmx?op=mt
示例1
SN= SDK-SSD-010-00001
PWD=3B5D3C427365F40C1D27682D78BB31E0
Mobile:139***404,138***213…………….
Content:测试
Ext: ""
Stime: ""
Rrid: ""
输出结果:
XML格式:
具体函数VB实现:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim SMS As New sdk2.WebService Dim sn$ = TextBox1.Text.Trim Dim pwd$ = TextBox2.Text.Trim Dim mobile$ = TextBox3.Text.Trim Dim content$ = TextBox4.Text.Trim ' pwd$ = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(sn$ & pwd$, "MD5") Dim md5 As New MD5CryptoServiceProvider Dim md5pwd As Byte() = (New ASCIIEncoding).GetBytes(sn + pwd) Dim mdByte As Byte() = md5.ComputeHash(md5pwd) Dim mdString As String = System.BitConverter.ToString(mdByte) pwd = mdString.Replace("-", "") If sn = "" Then MsgBox("需要输入序列号") Exit Sub End If If pwd = "" Then MsgBox("需要输入序列号密码") Exit Sub End If If mobile = "" Then MsgBox("发送号码不能为空") Exit Sub End If If content = "" Then MsgBox("发送内容不能为空") Exit Sub End If result = SMS.mt(sn, pwd, mobile, content, "", "", "") If Mid(result, 1, 1) <> "-" Then MsgBox("发送成功!返回值:" & result) Else MsgBox("发送失败!返回值:" & result) End If TextBox5.Text = "余额数:" + SMS.balance(sn, pwd) End Sub
四、MD5加密函数:
' ' Initialize the class ' This must be called before a digest calculation is started ' Public Sub MD5Init() ByteCounter = 0 State(1) = UnsignedToLong(1732584193.0#) State(2) = UnsignedToLong(4023233417.0#) State(3) = UnsignedToLong(2562383102.0#) State(4) = UnsignedToLong(271733878.0#) End Sub ' ' MD5 Final ' Public Sub MD5Final() Dim dblBits As Double Dim padding(72) As Byte Dim lngBytesBuffered As Long padding(0) = &H80 dblBits = ByteCounter * 8 ' Pad out lngBytesBuffered = ByteCounter Mod 64 If lngBytesBuffered <= 56 Then MD5Update(56 - lngBytesBuffered, padding) Else MD5Update(120 - ByteCounter, padding) End If padding(0) = UnsignedToLong(dblBits) And &HFF& padding(1) = UnsignedToLong(dblBits) \ 256 And &HFF& padding(2) = UnsignedToLong(dblBits) \ 65536 And &HFF& padding(3) = UnsignedToLong(dblBits) \ 16777216 And &HFF& padding(4) = 0 padding(5) = 0 padding(6) = 0 padding(7) = 0 MD5Update(8, padding) End Sub ' ' Break up input stream into 64 byte chunks ' Public Sub MD5Update(ByVal InputLen As Long, ByVal InputBuffer() As Byte) Dim II As Integer Dim I As Integer Dim J As Integer Dim K As Integer Dim lngBufferedBytes As Long Dim lngBufferRemaining As Long Dim lngRem As Long lngBufferedBytes = ByteCounter Mod 64 lngBufferRemaining = 64 - lngBufferedBytes ByteCounter = ByteCounter + InputLen ' Use up old buffer results first If InputLen >= lngBufferRemaining Then For II = 0 To lngBufferRemaining - 1 ByteBuffer(lngBufferedBytes + II) = InputBuffer(II) Next II MD5Transform(ByteBuffer) lngRem = (InputLen) Mod 64 ' The transfer is a multiple of 64 lets do some transformations For I = lngBufferRemaining To InputLen - II - lngRem Step 64 For J = 0 To 63 ByteBuffer(J) = InputBuffer(I + J) Next J MD5Transform(ByteBuffer) Next I lngBufferedBytes = 0 Else I = 0 End If ' Buffer any remaining input For K = 0 To InputLen - I - 1 ByteBuffer(lngBufferedBytes + K) = InputBuffer(I + K) Next K End Sub ' ' MD5 Transform ' Private Sub MD5Transform(ByVal Buffer() As Byte) Dim x(16) As Long Dim a As Long Dim b As Long Dim c As Long Dim d As Long a = State(1) b = State(2) c = State(3) d = State(4) Decode(64, x, Buffer) ' Round 1 FF(a, b, c, d, x(0), S11, -680876936) FF(d, a, b, c, x(1), S12, -389564586) FF(c, d, a, b, x(2), S13, 606105819) FF(b, c, d, a, x(3), S14, -1044525330) FF(a, b, c, d, x(4), S11, -176418897) FF(d, a, b, c, x(5), S12, 1200080426) FF(c, d, a, b, x(6), S13, -1473231341) FF(b, c, d, a, x(7), S14, -45705983) FF(a, b, c, d, x(8), S11, 1770035416) FF(d, a, b, c, x(9), S12, -1958414417) FF(c, d, a, b, x(10), S13, -42063) FF(b, c, d, a, x(11), S14, -1990404162) FF(a, b, c, d, x(12), S11, 1804603682) FF(d, a, b, c, x(13), S12, -40341101) FF(c, d, a, b, x(14), S13, -1502002290) FF(b, c, d, a, x(15), S14, 1236535329) ' Round 2 GG(a, b, c, d, x(1), S21, -165796510) GG(d, a, b, c, x(6), S22, -1069501632) GG(c, d, a, b, x(11), S23, 643717713) GG(b, c, d, a, x(0), S24, -373897302) GG(a, b, c, d, x(5), S21, -701558691) GG(d, a, b, c, x(10), S22, 38016083) GG(c, d, a, b, x(15), S23, -660478335) GG(b, c, d, a, x(4), S24, -405537848) GG(a, b, c, d, x(9), S21, 568446438) GG(d, a, b, c, x(14), S22, -1019803690) GG(c, d, a, b, x(3), S23, -187363961) GG(b, c, d, a, x(8), S24, 1163531501) GG(a, b, c, d, x(13), S21, -1444681467) GG(d, a, b, c, x(2), S22, -51403784) GG(c, d, a, b, x(7), S23, 1735328473) GG(b, c, d, a, x(12), S24, -1926607734) ' Round 3 HH(a, b, c, d, x(5), S31, -378558) HH(d, a, b, c, x(8), S32, -2022574463) HH(c, d, a, b, x(11), S33, 1839030562) HH(b, c, d, a, x(14), S34, -35309556) HH(a, b, c, d, x(1), S31, -1530992060) HH(d, a, b, c, x(4), S32, 1272893353) HH(c, d, a, b, x(7), S33, -155497632) HH(b, c, d, a, x(10), S34, -1094730640) HH(a, b, c, d, x(13), S31, 681279174) HH(d, a, b, c, x(0), S32, -358537222) HH(c, d, a, b, x(3), S33, -722521979) HH(b, c, d, a, x(6), S34, 76029189) HH(a, b, c, d, x(9), S31, -640364487) HH(d, a, b, c, x(12), S32, -421815835) HH(c, d, a, b, x(15), S33, 530742520) HH(b, c, d, a, x(2), S34, -995338651) ' Round 4 II(a, b, c, d, x(0), S41, -198630844) II(d, a, b, c, x(7), S42, 1126891415) II(c, d, a, b, x(14), S43, -1416354905) II(b, c, d, a, x(5), S44, -57434055) II(a, b, c, d, x(12), S41, 1700485571) II(d, a, b, c, x(3), S42, -1894986606) II(c, d, a, b, x(10), S43, -1051523) II(b, c, d, a, x(1), S44, -2054922799) II(a, b, c, d, x(8), S41, 1873313359) II(d, a, b, c, x(15), S42, -30611744) II(c, d, a, b, x(6), S43, -1560198380) II(b, c, d, a, x(13), S44, 1309151649) II(a, b, c, d, x(4), S41, -145523070) II(d, a, b, c, x(11), S42, -1120210379) II(c, d, a, b, x(2), S43, 718787259) II(b, c, d, a, x(9), S44, -343485551) State(1) = LongOverflowAdd(State(1), a) State(2) = LongOverflowAdd(State(2), b) State(3) = LongOverflowAdd(State(3), c) State(4) = LongOverflowAdd(State(4), d) ' /* Zeroize sensitive information. '*/ ' MD5_memset ((POINTER)x, 0, sizeof (x)); End Sub
五、webservice返回集合对照表:
返回值 |
返回值说明 |
问题描述 |
-2 |
帐号/密码不正确 |
1.序列号未注册2.密码加密不正确3.密码已被修改4.序列号已注销 |
-4 |
余额不足支持本次发送(或者修改密码长度不正确) |
余额不足(或者修改密码长度不在6位到10位之间) |
-5 |
数据格式错误 |
只能自行调试了。或与技术支持联系 |
-6 |
参数有误 |
看参数传的是否均正常,请调试程序查看各参数 |
-7 |
权限受限 |
该序列号是否已经开通了调用该方法的权限 |
-8 |
流量控制错误 |
|
-9 |
扩展码权限错误 |
该序列号是否已经开通了扩展子号的权限,把ext这个参数置空。 |
-10 |
内容长度长 |
单字节不能超过1000个字符,双字节不能超过500个字符 |
-11 |
内部数据库错误 |
|
-12 |
序列号状态错误 |
序列号是否被禁用 |
-14 |
服务器写文件失败 |
|
-17 |
没有权限 |
如发送彩信仅限于SDK3 |
-19 |
禁止同时使用多个接口地址 |
每个序列号提交只能使用一个接口地址 |
-20 |
相同手机号,相同内容重复提交 |
|
-22 |
Ip鉴权失败 |
提交的IP不是所绑定的IP |
-23 |
缓存无此序列号信息 |
|
-601 |
序列号为空,参数错误 |
|
-602 |
序列号格式错误,参数错误 |
|
-603 |
密码为空,参数错误 |
|
-604 |
手机号码为空,参数错误 |
|
-605 |
内容为空,参数错误 |
|
-606 |
ext长度大于9,参数错误 |
|
-607 |
参数错误 扩展码非数字 |
|
-608 |
参数错误 定时时间非日期格式 |
|
-609 |
rrid长度大于18,参数错误 |
|
-610 |
参数错误 rrid非数字 |
|
-611 |
参数错误 内容编码不符合规范 |
|
-623 |
手机个数与内容个数不匹配 |
|
-624 |
扩展个数与手机个数数 |
|
-644 |
rrid个数与手机个数不一致 |
|
注:以上返回值针对个别方法.请具体参看每个用到方法的详细说明。
六、附加说明:
1.接口地址:
常用接口地址:http://sdk.entinfo.cn:8060/webservice.asmx (一般调用)
多线程接口地址:http://sdk.entinfo.cn:8061/webservice.asmx (java、andriod使用)
2.其它说明:
(1)开发使用的帐号必须为SDK开头,如SDK-SSD-010-00001,帐号第一次需要调用Register方法注册一次.仅需注册一次即可,信息必须真实
(2)UnRegister与Register配合使用, 连续使用不得超过10次/天;
(3)群发推荐使用接口方法 mt或者mdSmsSend (仅方法名不同);
3. 郑重声明:
(1)禁止相同的内容多个手机号连续一条一条提交. 否则禁用帐号,由此带来损失由客户自行负责.
(2)请客户提供外网服务器IP以便于绑定IP发送,提高账号的安全性!
(3)在程序里最好有配置文件,程序自动判断当某个接口连接超时提交速度变慢时.程序可以自动切换其它的接口以下是推荐的几个服务器,仅接口地址不同而已.方法全部相同;
地址1:http://sdk.entinfo.cn:8060/webservice.asmx
地址2:http://sdk2.entinfo.cn:8060/webservice.asmx
这些地址都是标准的webservice地址,C#,Java客户可以按照自己熟悉的方式去解析String
或者
地址1:http://sdk.entinfo.cn:8060/webservice.asmx?wsdl
地址2:http://sdk2.entinfo.cn:8060/webservice.asmx?wsdl
七、示例Demo源代码下载: