华为CMPP API开发短信问题!~急~JJMMGG救我啊~
光揽都接好了,也可以测试能连上移动的ISMG 网关,用一个C的软件能对移动给的ID和PWD进行正确的连接测试,,
但是用华为的API为什么连不上去?
程序
import com.huawei.smproxy.*;
import com.huawei.insa2.comm.cmpp.message.*;
import com.huawei.insa2.comm.cmpp30.message.*;
import com.huawei.insa2.util.*;
import java.util.*;
public class Demo30
{
private static Args args;
private static SMProxy30 myProxy= null;
static byte[] msg_Id=null;
static Date time;
static int query_Type;
static String query_Code;
static String reserve;
static int pk_Total=1;
static int pk_Number=1;
static int registered_Delivery=1;
static int msg_Level=1;
static String service_Id="websms";
static int fee_UserType=1;
static String fee_Terminal_Id="1";
static int fee_Terminal_Type=1;
static int tp_Pid=1;
static int tp_Udhi=0;
static int msg_Fmt=1;
static String msg_Src="websms";
static String fee_Type="02";
static String fee_Code="999";
static Date valid_Time;
static Date at_Time;
static String src_Terminal_Id="1";
static String[] dest_Terminal_Id={"13794....."};
static int dest_Terminal_Type=1;
static byte[] msg_Content={'1'};
static String LinkID="12";
public Demo30()
{
}
public static void main(String[] a) throws Exception
{
try
{
args = new Cfg("app.xml",false).getArgs("CMPPConnect");
System.out.println("Yes");
args.set("source-addr","id");//id
args.set("shared-secret","pwd");//pwd
System.out.println("Yes1");
myProxy= new SMProxy30(args);//get the connecttion
System.out.println("Yes2");
CMPP30SubmitMessage submitMsg =new CMPP30SubmitMessage(pk_Total,pk_Number,registered_Delivery,msg_Level,service_Id,fee_UserType,fee_Terminal_Id,fee_Terminal_Type,tp_Pid,tp_Udhi,msg_Fmt,msg_Src,fee_Type,fee_Code,valid_Time,at_Time,src_Terminal_Id,dest_Terminal_Id,dest_Terminal_Type,msg_Content,LinkID);
// CMPP30SubmitRepMessage cc=new CMPP30SubmitRepMessage(msg_Id);
System.out.println("Yes3");
myProxy.send(submitMsg);
System.out.println("Yes4");
//CMPP30SubmitRepMessage submitRepMsg =
//CMPPCancelMessage cancelMsg =new CMPPCancelMessage(msg_Id);
// myProxy.send(cancelMsg);
// System.out.println("Yes5");
// CMPPCancelRepMessage cancelRepMsg =
CMPPQueryMessage queryMsg =new CMPPQueryMessage(time,query_Type,query_Code,reserve);
System.out.println("Yes6");
myProxy.send(queryMsg);
//CMPPQueryRepMessagemy queryRepMsg =
String stateDesc = myProxy.getConnState();
myProxy.close();
}
catch(Exception e)
{
System.out.println("Can not connect to ismg");
}
}
}
==================================================================================
错误信息
Yes
Yes1
Yes2java.lang.IllegalArgumentException: SMC发送过来的消息错误
at com.huawei.insa2.comm.cmpp30.message.CMPP30ConnectRepMessage.<init>(C
MPP30ConnectRepMessage.java:33)
at com.huawei.insa2.comm.cmpp30.CMPP30Reader.read(CMPP30Reader.java:46)
at com.huawei.insa2.comm.cmpp30.CMPP30Connection.connect(CMPP30Connectio
n.java:207)
at com.huawei.insa2.comm.PSocketConnection$1$ReceiveThread.task(PSocketC
onnection.java:226)
at com.huawei.insa2.util.WatchThread.run(WatchThread.java:48)
Yes3
null=====================================
Yes4
con not connect to ismg
Press any key to continue...