0
"서버가 요청을 처리 할 수 없습니다 ---> 인스턴스 오류"라는 오류 메시지가 나타납니다. SOAP 웹 서비스로 이미지를 업로드하려고 할 때.SOAP 웹 서비스로 서버에 이미지 업로드
제가 여기 붙어있어서 도와주세요. 나뿐만 바이트 배열 및 프로세스에 이미지를 변환
private class UploadImage extends AsyncTask<String, Void, String> {
@Override
protected void onPreExecute() {
progressDialog = new ProgressDialog(UploadImageActivity.this);
progressDialog.setIndeterminate(false);
progressDialog.setCancelable(false);
progressDialog.setMessage("Please wait..");
progressDialog.show();
}
@Override
protected String doInBackground(String... params) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 90, baos);
//bMap is the bitmap object
byte[] imagebyte = baos.toByteArray();
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("Email", UserContext.email);
request.addProperty("MobileNo", UserContext.mobilenumber);
request.addProperty("Image", imagebyte);
request.addProperty("Flage_InsertiedBy", UserContext.Flage_InsertiedBy);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
new MarshalBase64().register(envelope);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
webResponse = response.toString();
System.out.println("test response upload " + webResponse);
} catch (Exception e) {
System.out.println("test response upload ex " + e.getMessage());
}
return webResponse;
}
@Override
protected void onPostExecute(String result) {
progressDialog.dismiss();
}
'request.addProperty ("Image", imagebyte);'. 비누 서버에만 텍스트를 보낼 수 있다고 생각하십시오. 바이트가 아닙니다. 컴파일러는 여러분의 코드를'request.addProperty ("Image", imagebyte.toString());로 변환하여 바이트에서 문자열을 만들려고 시도합니다. 하지만 바이트 배열의 내용은 문자열로 보내지는 것이 아니라 배열의 Java 식별자 인 @ 12345ade와 같은 문자열로 전송됩니다. 참조하려면 imagebyte.toString()을 인쇄하십시오. – greenapps