tags:

views:

187

answers:

2

Please could you help me in sending a data from Mobile appication to Web Server in WBXML format ? I have got a bit to convert xml to wbxml but not getting how to send that to web server in efficient way ?

A: 

I think you could do a GET request, or POST if WBXML is too big.

fravelgue
+1  A: 

I'm not sure I fully understand your question but here goes...

You need to use a POST HTTP request, and write the WBXML data to the connection objects output stream. Here is a brief example, obviously you'll need more code for it to actually work:

byte[] wbxml = getMyWbxmlData();
HttpConnection conn = (HttpConnection)Connector.open("http://myserver.com/mywbxmlhandler");
conn.setRequestMethod(HttpConnection.POST);
OutputStream output = conn.openOutputStream();
output.write(wbxml);
InputStream input = conn.openInputStream(); // This will flush the outputstream
// Do response processing

That is all assuming your WBXML already includes the preamble, such as version number, public code page identifier etc.

roryf