I'm using a web service to transmit binary data.
using kSOAP on the BB it looks like this:
PHP Code:
SoapObject soap_Desc = new SoapObject("","Desc");
...
SoapObject rpc = new SoapObject(Predefined.getNameSpace(), Predefined.getWebMethod());
rpc.addProperty("Desc", soap_Desc);
rpc.addProperty("data", new SoapPrimitive (SoapEnvelope.ENC, "base64", packet_data));
rpc.addProperty("size", new Integer(packet_data.length()));
...
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = rpc;
...
On the server side your WS function must have a String - parameter (data) which will get your Base64 encoded string and decode it back to a byte array (e.g. Convert.FromBase64String() in .net)
btw. you don't have to use the Base64 class of kSOAP, use RIM's Base64OutputStream:
PHP Code:
// copy the next piece of data to send
bytexxx91;xxx93; requestData = Arrays.copy(data, (i-1)*max_packet_length, packet_length);
// ... and encode it to Base64 String
String stringData = Base64OutputStream.encodeAsString(requestData,0,requestData.length,false,false);
what you also see is that you have to split your data in small packets (I use 30k blocks), otherwise you will get problems transmitting large data (keep in mind that Base64 encoded byte array increases it's size by approx. 33%)