用asp如何开发wap push(转)
北京Openwave PUSH SERVER的地址为:
http://211.94.69.231:9001/pap(公网)
http://10.2.17.66:9001/pap(内网)
上海Openwave PUSH SERVER的地址为:
http://211.95.66.70:9001/pap(公网)
http://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 = "手机标识" +
"/TYPE=USER@gatewaybj.uni-info.com.cn";
static final String ppgAddress =
"http://211.94.69.231:9001/pap";
static final String SvcIndURI =
"http://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
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10294527/viewspace-125163/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10294527/viewspace-125163/
用asp如何开发wap push(转)相关推荐
- ASP.NET 开发WAP网站
使用ASP.NET开发WAP很简单,只需要新建一个空的网站,向其中添加移动WEB窗体即可.可以使用OPERA浏览器与M3GATE来调试网页, 强制输出WML,可以在WEB.CONFIG中 <sy ...
- asp.net开发wap程序必备:识别来访手机品牌型号
<script type="text/javascript"></script> <script type="text/javascript ...
- asp.net开发wap程序必备:识别来访手机品牌型号 选择自 Qqwwee_Com 的 Blog
我们在开发wap应用程序需要有识别来访手机品牌型号的功能,这样才可以更好的为用户提供更好的个性化服务,比如图片类型.屏幕尺寸.铃声类型等. http协议中,User-Agent这个标头指示的浏览器信息 ...
- 用asp.net开发移动wap网站集成在线wap模拟器
下面的代码将演示利用ASP.NET2.0开发WAP模拟器和支持移动设备浏览的网页 注:通过目录下的/moni可以模拟浏览我们制作好的wap网站 我们先实现一个Page类,添加一些于aspx页的交互,因 ...
- WAP Push SP接口协议
1.术语说明 1) DSMP Data Service Management Platform,数据业务管理平台.中国移动集团公司的移动数据业务平台,移动梦网计划(Monternet)的核心 ...
- [原]Wap push over sms 实践
Wap push over sms 实践 author:clapton_xpAThotmailDOTcom 20060323 通过短信进行点对点的WAP PUSH,本质上来说应该是发送一个wap页面 ...
- 《ASP.NET 开发从入门到精通》----2.3 编译和部署ASP.NET程序
本节书摘来自异步社区<ASP.NET 开发从入门到精通>一书中的第2章,第2.3节,著 张明星 ,责任编辑 张 涛, 更多章节内容可以访问云栖社区"异步社区"公众号查看 ...
- 用 ASP.NET 开发 Web 服务的五则技巧
(转的,作者不详) 一.禁用HTTP POST/GET协议 除非另外指定,否则,.NET将试图把Web服务绑定到三种协议:HTTP/POST.HTTP/GET和SOAP.之所以说"试图&qu ...
- 开发WAP站点之---使用PC电脑浏览器访问WAP手机站点 (转)
转自:http://www.cnblogs.com/taven/archive/2009/11/24/1609873.html 3G时代来了,公司最近要求我们也要做WAP版本的站点系统了,我们平时做的 ...
- ASP.NET开发要抛弃ASP旧习和破烂
ASP.NET开发要抛弃ASP旧习和破烂 使用ASP没有错,只要适用够用就行了.但是在用ASP.NET开发网站或系统的时候,应该抛弃开发ASP时形成的习惯,用ASP.NET的方法去开发,而不是在ASP ...
最新文章
- Linux 硬链接和软链接的区别
- MySQL中的索引(普通索引篇)
- Qt Creator使用自定义字体
- 强势回归!比 Python 快 20% 的 Pyston v2.0 来了!
- 第八章 数据结构与算法
- 开发悬赏平台APP心得
- psnr--峰值信噪比
- 淘宝按图搜索商品(拍立淘)、图片上传API接口、图片识别商品接口img2text标题栏、链接及图片相关参数字段API数据获取调用示例
- 微信小程序button修改边框样式after
- 博客园主题美化(仅兼容 Markdown)
- 阿里云教你掌握API的使用方法
- php 微信创建客服,如何给微信小程序内添加客服按钮
- 031--python--打印机票页面
- 7-1 厘米换算英尺英寸(基础编程题)
- 首页布局跟小程序如何配置Iconfont—小程序入门与实战(七)
- 数据库关于事务的详解分析(全)包含面试常问的细节
- iOS冰与火之歌番外篇 - 在非越狱手机上进行App Hook(转载)
- 如何设置数据库最大连接数
- 【每日前端】京东1号店注册——登录页面CSS实现
- 三种条码code39和code93以及code128在应用中的比较