⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smgpsmproxydemo.java

📁 pk_Total - 相同msg_Id消息总条数 pk_Number - 相同msg_Id的消息序号 registered_Delivery - 是否要求返回状态报告 msg_Level - 信
💻 JAVA
字号:
package demo.smgpdemo ;

import com.huawei.smproxy.comm.smgp.message.* ;
import com.huawei.smproxy.util.Args ;
import com.huawei.smproxy.util.Cfg ;

/**
 * SMGP协议测试代码
 */

public class SMGPSMProxyDemo
{

	public SMGPSMProxyDemo ()
	{
	}

	public static void main ( String[] args )
	{

		try
		{
			Args cfgArgs = new Cfg ( "config.xml" ).getArgs ( "SMGPConnect" ) ;
			//可以在程序中重新指定配置参数的值,也可以就使用配置文件中的值
			//cfgArgs.set("clientid","sp");
			//cfgArgs.set("shared-secret","new");
			MySMGPSMProxy mySMProxy = new MySMGPSMProxy ( cfgArgs ) ;

			//构造submit消息
			String[] rcvMobile = new String[2] ;
			rcvMobile[0] = "13388800001" ;
			rcvMobile[1] = "13300000002" ;

			SMGPSubmitMessage msg = new SMGPSubmitMessage (
				9 ,
				1 ,
				9 ,
				"goodnews13" ,
				"01" ,
				"999" ,
				"" ,
				8,
//				new java.util.Date ( System.currentTimeMillis ()
//				+ 2 * 24 * 60 * 60 * 1000 ) ,
//				new java.util.Date ( System.currentTimeMillis ()
//				+ 2 * 24 * 60 * 60 * 1000 ) ,
				"060429101215032+",
				"060429201215032+",
				"13912345678" ,
				"" ,
				rcvMobile ,
				"this isa test^&*%*发送消息,中国人好样的" ,
				"0123" ) ;
			//发送消息
			SMGPSubmitRespMessage respMsg = ( SMGPSubmitRespMessage ) mySMProxy.
				send ( msg ) ;
			if ( respMsg != null )
			{
				System.out.println (
					"Get SubmitResp Message Success! The status = "
					+ respMsg.getStatus () ) ;
			}
			else
			{
				System.out.println ( "Get SubmitResp Message Fail!" ) ;
			}
			//--------查询消息----------

			//--------转发消息----------

			//--------MO Route Update Message----------

			//--------MT Route Update Message----------

			try
			{
				Thread.sleep ( 600000 ) ;
			}
			catch ( InterruptedException ie )
			{
				ie.toString () ;
			}

			//关闭连接
			mySMProxy.close () ;
		}
		catch ( Exception e )
		{
			e.printStackTrace () ;
		}
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -