移动短信网关接入-华为API-CMPP2_SubmitSM
实在找不到地方求助了,中国移动也没技术人员对接,我只能来求助完成的CSDN了
移动短信网关接入,使用的是华为API,初始化接口和登录都OK了,但发送短信不行。
'-----------------------------接口函数 ------------------------------
'初始化接口
<DllImport("SMEIDll.dll", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function _
CMPP2_IFInitInterface( _
ByVal dwCodeProtocol As Byte, _
ByVal dwDriverProtocol As Byte, _
ByVal pDriverParam As Byte() _
) As Boolean
End Function
'释放接口
<DllImport("SMEIDll.dll", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function _
CMPP2_IFExitInterface( _
) As Boolean
End Function
'登录
<DllImport("SMEIDll.dll", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function _
CMPP2_Login_R( _
ByVal SystemID As String, _
ByVal Password As String, _
ByVal byIFver As Byte _
) As Boolean
End Function
'退出登陆
<DllImport("SMEIDll.dll", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function _
CMPP2_Logout( _
) As Boolean
End Function
'检查是否有收信
<DllImport("SMEIDll.dll", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function _
HasDeliverMessage( _
ByVal dwTimeOut As Byte _
) As Integer
End Function
'检查是否有收信
<DllImport("SMEIDll.dll", CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function _
CMPP2_SubmitSM( _
ByVal byMsgID As Byte, _
ByVal byPKTotal As Byte, _
ByVal byPKNumber As Byte, _
ByVal SRR As Byte, _
ByVal byMsglevel As Byte, _
ByVal sServiceType As String, _
ByVal byFeeUserType As Byte, _
ByVal sFeeAddr As String, _
ByVal PID As Byte, _
ByVal UDHI As Byte, _
ByVal DCS As Byte, _
ByVal sSPID As String, _
ByVal sFeeType As String, _
ByVal sFeeCode As String, _
ByVal Expire As String, _
ByVal Schedule As String, _
ByVal OrgAddr As String, _
ByVal byUserNum As Byte, _
ByVal sDestAddrs As String, _
ByVal UDLen As UInt32, _
ByVal UserData As String, _
ByVal FCS As Integer _
) As Integer
End Function
‘-------------------------------------初始化和登录 (没问题)-----------------------------
Dim dwCodeProtocol As Byte = 5
Dim dwDriverProtocol As Byte = 1
Dim pDriverParam As Byte() = Encoding.ASCII.GetBytes("221.131.129.71 7890 5000")
Dim SystemId As String = "123456"
Dim PassWord As String = "123456"
Dim byIfver As Byte = 0
CMPP2_IFInitInterface(dwCodeProtocol, dwDriverProtocol, pDriverParam).ToString
CMPP2_Login_R(SystemId, PassWord, 32).ToString
’-------------------------------发送短信 (问题在下面 )--------------------------
Dim byMsgID As Byte = 0
Dim byPKTotal As Byte = 1
Dim byPKNumber As Byte = 1
Dim SRR As Byte = 1
Dim byMsglevel As Byte = 0
Dim sServiceType As String = "MJS0019903"
Dim byFeeUserType As Byte = 2
Dim sFeeAddr As String = ""
Dim PID As Byte = 0
Dim UDHI As Byte = 0
Dim DCS As Byte = 15
Dim sSPID As String = ""
Dim sFeeType As String = "01"
Dim sFeeCode As String = "00"
Dim Expire As String = ""
Dim Schedule As String = ""
Dim OrgAddr As String = "1062xxxx"
Dim byUserNum As Byte = 1
Dim sDestAddrs As String = "8613665185xxx"
Dim UserData As String = "hello 你好"
Dim UDLen As UInt32 = System.Text.Encoding.Default.GetBytes(UserData).Length
Dim FCS As Integer = 0
dim retInt as integer= CMPP2_SubmitSM(byMsgID, byPKTotal, byPKNumber, SRR, byMsglevel, sServiceType, byFeeUserType, sFeeAddr, PID, UDHI, DCS, sSPID, sFeeType, sFeeCode, Expire, Schedule, OrgAddr, byUserNum, sDestAddrs, UDLen, UserData, FCS)
返回的参数是 11 附录表代码没有11的,而且手机也收不到短信。
移动现在也没有技术人员在对接时做支持。
问题猜测:
1。 调用时数据类型转换错误
2。 参数赋值不符合网关要求。