0
비트 맵을 android에서 기본 64 문자열로 변환하고 내 dotnet 웹 서비스로 전달했습니다. android.Here에서java.lang.String 유형의 값 A는 string64를 json webservice에 전달할 때 JSONObject로 변환 될 수 없습니다.
org.json.JSONException: Value A of type java.lang.String cannot be converted to JSONObject
오류가 인코딩도 JSONObject jobj=new JSONObject(jsonResponse);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
photo.compress(Bitmap.CompressFormat.JPEG, 90, baos);
byte[]imagedata= baos.toByteArray();
encodedImage = Base64.encodeToString(imagedata, Base64.NO_WRAP);
JSONObject json = new JSONObject();
json.put("userid", "1021");
json.put("bmp", encodedImage);
HttpParams httpParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParams,
7000);
HttpConnectionParams.setSoTimeout(httpParams, 7000);
HttpClient client = new DefaultHttpClient(httpParams);
HttpPost request = new HttpPost("http://192.198.0.220/WebService.asmx/Save");
request.setEntity(new ByteArrayEntity(json.toString().getBytes(
"UTF8")));
request.setHeader("Content-Type","application/json");
HttpResponse response = client.execute(request);
//HttpEntity entity = response.getEntity();
String jsonResponse = EntityUtils.toString(response.getEntity());
// If the response does not enclose an entity, there is no need
JSONObject jobj=new JSONObject(jsonResponse);