BlackBerry Forums Support Community

BlackBerry Forums Support Community (http://www.blackberryforums.com/)
-   BES Admin Corner (http://www.blackberryforums.com/bes-admin-corner/)
-   -   Pushing to BES from application (http://www.blackberryforums.com/bes-admin-corner/261218-pushing-bes-application.html)

LCBStanley 08-24-2012 09:19 AM

Pushing to BES from application
 
I folks, I am not the BES Admin in my organization, but I own an application that leverages the BES for a third party application to notify for events. (Service Desk event>third party notifier>BES)

We are wanting to do-away with the third party to save some $$, so I am trying to write a custom java notifier app. I am connecting to the BES and receiving 200: OK response codes, but nothing is coming through on my browser. I assume this means there is something wrong with the format/content I am pushing. I don't fully understand the URI thing, but basically I only need to push a subject and body. Maybe the body will be html formatted down the road, but I am not looking to push anything fancy like an XML.

LCBStanley 08-24-2012 09:21 AM

Re: Pushing to BES from application
 
connection.setDoOutput(true);

connection.setRequestMethod("POST");
connection.setFollowRedirects(true);

String query = "summary=" + "test";
query += "&";
query += "body=" + "testtesttest body";

connection.setRequestProperty("Content-length",String.valueOf (query.length()));
connection.setRequestProperty("Content-Type","text/plain");
connection.setRequestProperty("User-Agent", "Mozilla/5.0 (BlackBerry; U; BlackBerry AAAA; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/X.X.X.X Mobile Safari/534.11+");

// open up the output stream of the connection
DataOutputStream output = new DataOutputStream( connection.getOutputStream() );

// write out the data
int queryLength = query.length();
output.writeBytes( query );
output.close();

System.out.println("Resp Code:"+connection.getResponseCode());
System.out.println("Resp Message:"+ connection.getResponseMessage());
}
catch(Exception e)
{
System.out.println( "Something bad just happened." );
System.out.println( e );
e.printStackTrace();
}
}
}

LCBStanley 08-24-2012 09:22 AM

Re: Pushing to BES from application
 
Its not letting me post the connection stuff, because it thinks it is a URL =(

I open an httpconnection with the u.r.l. server/push?DESTINATION=PIN&PORT=7874&REQUESTURI=/

freakinvibe 08-24-2012 11:15 AM

Re: Pushing to BES from application
 
Try posting in the developer section:

Developer Forum - BlackBerry Forums Support Community


All times are GMT -5. The time now is 07:28 PM.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.