0

编码

Bitmap bmp = (Bitmap)extras.get("data");
ByteArrayOutputStream out = new ByteArrayOutputStream();
bmp.compress(CompressFormat.JPEG, 100, out);
byte[] raw = out.toByteArray();
PassToWebservice(raw); //error

PassToWebservice(byte[] ba)
{
   SoapObject envelope...
   envelope.addProperty("base64bytes", ba);
   ...
   transport.call(ACTION, envelope);
   envelope.getResponse() //error: IOException cannot serialize...
}

问题
当我将压缩图像传递给我的 web 服务时,我得到一个运行时异常,上面写着“无法序列化 [B@47bcb6c8 ...”我看不到某些东西,谁能明白为什么上面的(伪)代码不起作用?如果它有帮助,在 web 服务服务器端,当服务器将传递的字节写入文件(使用 .Net IO.File.WriteAllBytes)时似乎发生了异常

堆栈跟踪
在此处输入图像描述

4

2 回答 2

2

我需要这样做:

MarshalBase64 marshal;
marshal.register(envelope);
于 2011-02-15T23:09:43.227 回答
0

SoapSerializationEnvelope 信封 = 新 SoapSerializationEnvelope(SoapEnvelope.VER11);

        new MarshalBase64().register(envelope);   // this is will over Cannot serialize: [B@f034108 

        envelope.dotNet = true;
        //Set output SOAP object
        envelope.setOutputSoapObject(request);
        //Create HTTP call object
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

        try {
            androidHttpTransport.call(SOAPACTION, envelope);
            SoapObject response = (SoapObject) envelope.getResponse();
于 2018-07-20T18:59:25.330 回答