收藏文章 楼主
用asp如何开发wap push?
网友【老编】 2007-03-18 20:51:00 分享在【时代发展的印记】版块    1    1
对于WAP PUSH服务,CP/SP需要向中国联通申请该类服务,并且CP/SP所提供的WAP PUSH内容所在的服务器能够与中国联通的 Openwave PUSH Server连通,连接方式分为内网连接和公网连接两种方式,由CP/SP根据自身实际情况选择连接方式。Openwave PUSH Server分别位于北京、上海两地,CP/SP根据就近原则选择需要连接的Openwave PUSH Server。CP/SP需要向中国联通提交内容应用服务器的主域名或IP地址。
北京Openwave PUSH SERVER的地址为:
211.94.69.231:9001/pap(公网)
10.2.17.66:9001/pap(内网)
上海Openwave PUSH SERVER的地址为:
211.95.66.70:9001/pap(公网)
10.95.17.66:9001/pap(内网)。

下面以向北京Openwave PUSH SERVER发送请求为例说明如何提供WAP PUSH服务:
/*
* Title: WAP Push Library Service Indication Payload Example
* Description: A basic Push Submission example using a
* Service Indication payload
*/
import java.io.IOException;
import java.io.FileNotFoundException;
import java.net.MalformedURLException;
import java.net.URL;
import com.openwave.wappush.*;
public class ServiceInd {
//Constants used in this example.
static final String address = "手机标识" +
"/[email protected]";
static final String ppgAddress =
"211.94.69.231:9001/pap";
static final String SvcIndURI =
"devgate2.openwave.com/cgi-bin/mailbox.cgi";
static URL ppgURL = null;
static URL siURI = null;
public void SubmitMsg() throws WapPushException, IOException,
MalformedURLException {
//Instantiate and initialize the Pusher object.
Pusher ppg = new Pusher(ppgURL);
ppg.initialize();
//Instantiate the Service Indication object.
//This is the text string to send to the client device.
String alertText = "Mobile Mail: New message!";
ServiceIndication serviceIndication =
new ServiceIndication(alertText);
//Set the URI for this SI.
serviceIndication.setHref(siURI);
//Add some optional information to the SI.
ServiceIndicationInfo info =
new ServiceIndicationInfo("Mailbox", "Full");
info.AddInfoBlock("ReadMessages", "All");
serviceIndication.setInfo(info);
//Set the Service Indication action to signal-high.
serviceIndication.setAction(ServiceIndicationAction.signalHigh);
//Add some optional time information.
serviceIndication.setExpires(
new DateTime(2004, 6, 15, 12, 0, 1));
serviceIndication.setCreated(
new DateTime("2002-06-15T12:00:00Z"));
//Instantiate the push message object and set some
//optional information.
PushMessage pushMessage = new PushMessage(pushID, address);

pushMessage.setDeliverBeforeTimestamp(new
DateTime("2004-06-15T12:00:01Z"));
//Instantiate a MimeEntity and add the PushMessage
//and ServiceIndication objects.
MimeEntity me = new MimeEntity();
me.addEntity(pushMessage);
me.addEntity(serviceIndication);
//Send the push message
PushResponse pushResponse = (PushResponse) ppg.send(me);
//Read some information from the response.
System.out.println("reply-Time = " +
pushResponse.getReplyTime());
System.out.println("response-result-code = " +
pushResponse.getResultCode());
System.out.println("response-result-desc = " +
pushResponse.getResultDesc());
}//SubmitMsg()
public static void main(String[] args) throws WapPushException,
IOException {
try {
ppgURL = new URL(ppgAddress);
siURI = new URL(SvcIndURI);
ServiceInd si = new ServiceInd();
si.SubmitMsg();
}
//Handle possible exceptions.
catch (BadMessageException exception) {
System.out.println("*** ERROR - bad message exception");
BadMessageResponse response = exception.getResponse();
System.out.println("*** ERROR = " +
response.getBadMessageFragment());
}
catch (WapPushException exception) {
System.out.println("*** ERROR - WapPushException (" +
exception.getMessage() + ")");
}
catch (FileNotFoundException exception) {
System.out.println("*** ERROR - input file not found");
}
catch (MalformedURLException exception) {
System.out.println("*** ERROR - malformed PPG URL");
}
catch (IOException exception) {
System.out.println( "*** ERROR - I/O exception");
}
catch (Exception exception) {
System.out.println("*** ERROR - exception(" +
exception.getMessage() + ")");
}
}//main()
}//class ServiceInd
meiguo.com 发布人签名/座右铭这家伙浪费了“黄金广告位”,啥也没签!
大家都在看
回复/评论列表
默认   热门   正序   倒序
meiguo.com 创始人

emotion

1   2007-03-18 20:51:00  回复

回复/评论:用asp如何开发wap push?

暂无用户组 升级
退出
等级:0级
美果:
美过
精华推荐
  1. 中美高层通话后… 川普总统计划明年访华,芯片管制也松口了!
  2. MIT稳居了CS榜首!美国大学的最新排名出炉
  3. 45岁后“人生黄金期”是认知和创造力的新高峰
  4. 川普政府再次出奇招!拒绝所有胖子的移民申请?
  5. 中美经贸磋商“展现战略对称”新态势
  6. 一美分硬币“Penny”铸造历史正式终结
  7. 中美AI竞争的新格局已定?
  8. 2026年版的“公共负担”新规复活,华人家庭遭遇精准打击!
  9. 美国司法部起诉了柬埔寨“电信诈骗集团”的头目
  10. ICE启动了在社交媒体的全天候监控项目
  11. 黄仁勋警示川普政府,再不开放“对华AI芯片出口”就来不及啦!
  12. 五角大楼的机密报告:中国导弹可以击沉美军航母
  13. 美国在AI竞争中失利了?阿里千问模型在全球领先
  14. 川普总统正式签属涉台法案,解放军示警!
  15. 中国已经全额缴纳了联合国会费,联合国的财政危机缓解!
  16. 700万人参与了反川普集会?
  17. AWS最大区域故障,带崩多项服务!
  18. 学习英语12年后,终于实现了“美国梦”!
  19. SpaceX在加速IPO计划,目标估值1.5万亿美元!
  20. 美国移民局(ICE)新提案打算限制福利使用,有记录者可能影响绿卡申请!
  21. 感恩节餐桌的费用回落,零售商推出了低价套餐!
  22. 恢复或加入?重获中国国籍的路径比较
  23. 联邦政府启动“红色日落行动” 审查比特币矿机的供应链
  24. 人类史上“最贵CEO”诞生!马斯克的“万亿薪酬”背后
  25. 全球高等教育的新趋势:留学生求学地“多元化”
  26. 美国的房地产市场显现了矛盾信号
  27. 美国“H-1B”签证新规:在境内的申请人,免缴10万美元费用!
  28. 中美稀土博弈,美国政策在急转直下!
  29. 美国仍然依赖纸质信件的真相剖析
  30. 中美两国元首在釜山会晤:就关税、大豆和稀土已经达成共识
  31. 英伟达H200芯片的对华销售仍然在受美国的两重限制
  32. 在海外漂泊12年后的真实感受
  33. 川普政府终于听说了日本新首相【高市早苗】因为台海表态引发外交危机的事儿了?
  34. 美国政府批准了对台3.3亿美元的军售
  35. 美国青少年“67”流行语的现象引关注
  36. 外国人的入境中国手续简化,可以提前在网上填报入境卡了!
头像

用户名:

粉丝数:

签名:

资料 关注 好友 消息
已有0次打赏
(1) 分享
分享
取消