I am trying to build a web service to interact with a mobile application that requires a secure connection.
Over an unsecured connection, I get the desired JSON Result from the server and can build the approprioate JSON object (on the test device).
The desired JSON result is:
{"memberID":"999999","statusCode":"0","message":"Your member information has been processed, please confirm to continue with payment.","total":"66.66"}
However, using a secure connection, the controller returns:
ur member information has been processed, please confirm to continue with payment.","total":"66.66"}
The server side code is simple for now:
[HttpPost]
public JsonResult startTransaction( FormCollection form ) {
// process form values
Dictionary<string,string> result = new dictionary<string,string>();
result.Add("memberID","999999");
result.Add("statucCode","0");
result.Add("message","Your member information has been processed, please confirm to continue with payment.");
result.Add("total","66.66");
return Json(result);
}
If it helps, for development, on the device side (Android), I am accepting all certificates for https.
I am not sure how the response is getting shortened in such a way.
UPDATE:
After trying Fiddler2, Firebug, and JSONView, I still can’t seem to resolve the error.
The code (on the Android device) where the response is read is:
responseStream = connection.getInputStream();
int bytesRead = -1;
byte[] buffer = new byte[8*1024];
while( (bytesRead = responseStream.read(buffer)) >= 0 ) {}
response = new String( buffer );
I thought the buffer was too small, but that is not the case, since I have tried larger buffer sizes.
I would try Fiddler or Firebug to perform the HTTPS request and see what the result is. This way you could find out if the problem is on the server or on the client side..