I am able to send custom object to my .net webservice and my webmethod is working absolutely fine. I tested that code on multiple phone and result was success but when I was trying it on samsung mobile it started to give me exception.
I found that problem is MemoryOutOfException which is occuring because I have recorded large size of video and trying to convert that into byte[] but I was expected to record less quality video which is working in Micromax and Motorola but not in samsung (rest brands I don't know yet).
takeVideoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY,
MYVIDEOQUALITY);
so here is the some of the solution I think I should have:
1. Either record less size video from Camera Intent
in all mobile(not working in samsung).
2. Or code your video upload method in such way that it will upload video in chunks. but I have to send more information about the video so I have created custom object to handle it and I have also implemented KVMSerializable
and used Marshal
also. Now I don't know how to send Large Custom object in chunks.
I have seen this but I don't find I can send addition information along with it. it is send only video file alone.
If i am not clear enough please let me know what more information I should provide.
Here is the code that I am using to upload video :
private String SaveMedia(String Email, byte[] Media, String MediaType,
String MediaExt) {
SoapSerializationEnvelope envelope;
SoapObject request = new SoapObject(
HelpMeConstant.WSDL_TARGET_NAMESPACE, "SaveMedia");
// Log.i(TAG, "Email : " + Email + ", Media : " + Media + "MediaType : " + MediaType + ",MediaExt : " + MediaExt);
MediaAvidance mediainfo = new MediaAvidance();
mediainfo.EmailId = Email;
mediainfo.Media = Media;
mediainfo.MediaExt = MediaExt;
mediainfo.MediaType = MediaType;
PropertyInfo pi = new PropertyInfo();
pi.setName("avidanceinfo");
pi.setValue(mediainfo);
pi.setType(mediainfo.getClass());
request.addProperty(pi);
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
// Log.i("SaveMedia", "Serialising..");
new MarshalBase64().register(envelope);
envelope.dotNet = true;
envelope.headerOut = HelperMethod.addAuthentication();
envelope.implicitTypes = true;
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(
HelpMeConstant.SOAP_ADDRESS);
Object response = null;
try {
// Log.i("SaveMedia", "Calling service..");
httpTransport.call(HelpMeConstant.SOAP_ACTION + "SaveMedia",
envelope);
// Log.i("SaveMedia", "getting response..");
response = envelope.getResponse();
} catch (Exception exception) {
// Log.e("SaveMedia", "I got an error :", exception);
response = exception.toString();
}
return response.toString();
}
Thanks in Advance for your response.