作爲我項目的一部分,我需要將圖像上傳到服務器。在服務器部分,我有一個Web服務,它將接受字節數組並將其轉換爲圖像。在我的客戶端部分(Android + ksoap2)中,我使用Base64編碼將圖像轉換爲byte []數組。但是我無法將字節數組傳遞給Web服務。它顯示出一些序列化問題。 我如何使用ksoap2.Somebody請幫我的字節數組傳遞到Web服務.....將圖像上傳到服務器
0
A
回答
1
使用MarshalBase64
MarshalBase64 marshal = new MarshalBase64();
ByteArrayOutputStream out = new ByteArrayOutputStream();
bmp.compress(CompressFormat.PNG, 100, out);
byte[] raw = out.toByteArray();
SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,
OPERATION_NAME);
request.addProperty("image", raw);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
marshal.register(envelope);
HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
try
{
httpTransport.call(SOAP_ACTION, envelope);
Object response = envelope.getResponse();
}
catch (Exception exception)
{
exception.printStackTrace();
}
}
參考Serialize byte array using ksoap android嘗試使用此代碼
序列化的字節數組
+0
我會試着用這個代碼.......謝謝.... – Jithin 2011-03-27 18:25:14
相關問題
- 1. 將圖像上傳到服務器symfony2
- 2. 將圖像上傳到服務器ImageSwitcher
- 3. android將圖像上傳到服務器
- 4. 將圖像上傳到從服務器
- 5. 將圖像上傳到服務器angularjs
- 6. 上傳圖像服務器上傳圖像服務器
- 7. 將圖像上傳到服務器上之前旋轉圖像
- 8. 將圖像上傳到服務器並將url保存到服務器
- 9. 將圖像上傳到服務器會破壞圖像
- 10. 圖像上傳到JSP服務器
- 11. Django:圖像上傳到服務器
- 12. 上傳圖像到服務器的URL
- 13. 上傳圖像到服務器
- 14. 上傳圖像文件到服務器
- 15. 圖像上傳到服務器錯誤
- 16. 離子上傳圖像到服務器
- 17. JSON和上傳圖像到服務器
- 18. 如何上傳圖像到服務器
- 19. 圖像上傳到.NET服務器
- 20. 從iPhone上傳圖像到服務器
- 21. [Android] - 將圖片上傳到服務器
- 22. Xamarin:將圖片上傳到服務器
- 23. 如何在Android上將圖像保存/上傳到服務器?
- 24. 在iOS上更快地將圖像上傳到服務器
- 25. 如何將圖像上傳到服務器上的變化
- 26. 將圖像上傳到同一服務器上的其他域
- 27. 如何在iOS上將圖像數據上傳到服務器?
- 28. 將位圖圖像上傳到服務器並加裝
- 29. 服務器上的圖像上傳
- 30. 將圖像上傳到圖庫中以便將圖像上傳到服務器的位置
接受答案..如果得到解決方案 – MorningGlory 2011-11-21 12:05:27