Create WAP Push SMS Messages (from C# to JAVA)
ÖíÄêÎÞÁÄ,¸ÄÁËÒ»¸ö´úÂ룬ÓеãD°æÄǸöÒâ˼£¬°ÑWAP PUSHµÄC#´úÂë¸Äµ½ÁËJAVA
ÔÀ´³ö´¦£º
http://www.codeproject.com/cs/internet/wappush.asp
¸Ä¹ýºóµÄ´úÂëÔÚÏÂÃæ£¬³ÌÐòºÃÏñ¿ÉÒÔÊä³öÁËWAPPUSHµÄ½á¹¹»¯µÄ¶«Î÷£¬µ«ÊÇ£¬Ã»ÓÐÔÚCMPPÐÒéÉϲâÊÔͨ¹ý¡£
¹²7¸öÎļþ£º
package com.wap.wbxml;
public class Runner {
/**
* @param args
*/
public static void main(String[] args) {
try
{
String recipient = ""; // mobile number to send the message to
String href = "http://wap.monternet.com"; // url of the content to be pushed
String text = "A WAP Push to ÃÎÍø site"; // description of the content displayed to the user
PushMessage message = new PushMessage(href, text);
HexDecoder decoder = new HexDecoder();
// Console.WriteLine("SMS body");
System.out.println("SMS body");
// Console.WriteLine(body);
String body = new String(decoder.GetChars(message.GetSMSBytes()));
System.out.println(body);
body =byteToHexStr(message.GetSMSBytes());
System.out.println(body);
// this body is now ready to be sent, either via
// an SMS Web Service as shown below or
// via a mobile phone on a serial port.
// Making sure the message is flagged as containing
// a User Data Header
// A free evaluation account for this service can
// be set up at https://www.esendex.com/secure/registration/evaluation.aspx
// messenger.MessengerHeader header = new messenger.MessengerHeader();
// header.Username = ""; // username for the SMS account
// header.Password = ""; // password for the SMS account
// header.Account = ""; // account reference
//
// messenger.SendService service = new messenger.SendService();
// service.Messeng
Ïà¹ØÎĵµ£º
µÚÒ»ÖÖDES¼ÓÃÜËã·¨
import java.security.Key;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
/**
*
* ʹÓÃDES¼ÓÃÜÓë½âÃÜ,¿É¶Ôbyte[],StringÀàÐͽøÐмÓÃÜÓë½âÃÜ ÃÜÎÄ¿ÉʹÓà ......
public static String getMD5(byte[] source) {
String s = null;
char hexDigits[] = { // ÓÃÀ´½«×Ö½Úת»»³É 16 ½øÖƱíʾµÄ×Ö·û
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
try
{
java. ......
ÎÒÃǾ³£Òª½«Êý×Ö½øÐиñʽ»¯£¬±ÈÈçÈ¡2λСÊý£¬ÕâÊÇ×î³£¼ûµÄ¡£Java Ìṩ DecimalFormat À࣬°ïÄãÓÃ×î¿ìµÄËٶȽ«Êý×Ö¸ñʽ»¯ÎªÄãÐèÒªµÄÑù×Ó¡£ÏÂÃæÊÇÒ»¸öÀý×Ó£º
importjava.text.DecimalFormat;
publicclassTestNumberFormat{
publicstaticvoidmain(String[]args){ ......
JavaÖеļòµ¥¹¤³§Ä£Ê½
¾ÙÁ½¸öÀý×ÓÒÔ¿ìËÙÃ÷°×JavaÖеļòµ¥¹¤³§Ä£Ê½£º
Å®æ´ÞÒÍÁÔìÈË
»°Ëµ£º“ÌìµØ¿ª±Ù£¬Î´ÓÐÈËÃñ£¬Å®æ´ÞÒÍÁΪÈË¡£”Å®æ´ÐèÒªÓÃÍÁÔì³öÒ»¸ö¸öµÄÈË£¬µ«ÔÚÅ®æ´Ôì³öÈË֮ǰ£¬È˵ĸÅÄîÖ»´æÔÚÓÚŮ洵Ä˼ÏëÀïÃæ¡£
Å®æ´ÔìÈË£¬Õâ¾ÍÊǼòµ¥¹¤³§Ä£Ê½µÄÓ¦Óá£
¡¡¡¡Ê×ÏÈ£ ......
StringºÍStringBufferµÄÇø±ð£¬ÍøÉÏ×ÊÁÏ¿ÉÒÔ˵ÊÇÊý²»Ê¤Êý£¬µ«ÊÇ¿´µ½ÕâÆªÎÄÕ£¬¸Ð¾õÀïÃæ×öµÄСÀý×ÓºÜÓдú±íÐÔ£¬ËùÒÔתһÏ£¬²¢×Ô¼º×öÁËÒ»µã×ܽᡣ
ÔÚjavaÖÐÓÐ3¸öÀàÀ´¸ºÔð×Ö·ûµÄ²Ù×÷¡£
1.Character ÊǽøÐе¥¸ö×Ö·û²Ù×÷µÄ£¬
2.String ¶ÔÒ»´®×Ö·û½øÐвÙ×÷¡£²»¿É±äÀà¡£
3.StringBuffer Ò²ÊǶÔÒ»´®×Ö·û½øÐвÙ×÷£¬µ«ÊÇ¿É ......