我试图将浏览器“浏览器消息”发送到我的设备,通过bes连接到mds。
当我发送请求(并请求标题......)时,响应是http 202,pap响应是1001,这是接受的。
当我检查设备时,什么也没发生,推送没有发送。 帮助我
这是我的班级:
public class PushSender {
IdGenerator idGenerator= new IdGeneratorImpl();
String destination ="7874";//for bes => port , for bis :app id
List<String> addresses = new ArrayList<String>();
//String mds="http://win-uhgr7vs88uz.assabb.com:8080/";
public void initPushSender() {
addresses.add("bestest@assa-associates.com");
PushMessageControl pushMessageControl=new PushMessageControl(false,idGenerator,"Marhaba push",addresses);
Content papContent =new TextContent("message a envoyer");
ContentType contentType=new ContentType("TEXT_PLAIN"); //TEXT_PLAIN//TEXT_HTML
papContent.setContentType(contentType);
papContent.setHeader("X-Wap-Application-Id", "/");
papContent.setHeader("X-Rim-Push-Type", "browser-message");
papContent.setHeader("X-Rim-Push-Title", "push title");
papContent.setHeader("X-Rim-Push-Dest-Port", "7874");
PushSDKPropertiesImpl properties=new PushSDKPropertiesImpl();
HttpClient client= new HttpClientImpl();
((HttpClientImpl) client).setPushSDKProperties(properties);
PapService papService=new PapServiceImpl();
papService.setHttpClient(client);
papService.setPushSDKProperties(properties);
try {
PushResponse response =papService.push(null,null,destination,pushMessageControl, papContent);
System.out.println("code Response: "+response.getCode());
System.out.println(response);
} catch (PushSDKException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (BadMessageException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnauthorizedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void main(String []args){
PushSender pu=new PushSender();
pu.initPushSender();
}
}
即使我尝试发送轮圈推送,响应也是1001,但推送未送达。
当我使用示例c#app时,推送
答案 0 :(得分:0)
请您确认是否能够使用安装目录中的JDE示例通过BES / MDS成功进行PAP推送
服务端应用: C:\ Eclipse的\插件\ net.rim.ejde.componentpack7.0.0_7.0.0.33 \部件\样品\ COM \轮缘\样品\服务器\ httppushdemo
客户端应用: C:\ Eclipse的\插件\ net.rim.ejde.componentpack7.0.0_7.0.0.33 \部件\样品\ COM \轮缘\样品\设备\ httppushdemo
如果您使用可靠的推送,请确保将此端口添加到您的BES配置中。 http://docs.blackberry.com/en/admin/deliverables/14334/Specify_device_ports_for_reliable_push_requests_490067_11.jsp
谢谢,
Gurtej