如何将图像从wcf ksoap2传输到android [英] How to transfer images from wcf ksoap2 to android

查看:215
本文介绍了如何将图像从wcf ksoap2传输到android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将图像从wcf ksoap2发送到android。

在wcf方面,我已将所有图像转换为字节数组并将它们存储在ArrayList中。

At android方面我从wcf响应中填充了ArrayList。

现在问题是字节数​​组没有正确接收,字节数组没有转换成Image / BufferedImage。



这是我的代码



I am trying to send images from wcf ksoap2 to android.
At wcf side I have converted all images into byte array and stored them in an ArrayList.
At android side I fill the ArrayList from wcf response.
Now the problem is byte array is not receiving properly and byte array is not converting into Image/BufferedImage.

Here is my code

byt = new byte[4096];
        byt = (byte[]) al.get(5);
        //Image im;
        BufferedImage bImageFromConvert = null;
        InputStream in = new ByteArrayInputStream(byt);

        try {
            bImageFromConvert = ImageIO.read(in);
            //ImageIO.write(bImageFromConvert, "jpg", new File(
            //      "c:/new-darksouls.jpg"));               

        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
}

推荐答案

您可能想查看 transfer-byte-array-from-soap-service-to-android [ ^ ]



与指针一样,我无法看到收到的数据是否已编码,或者即使您在获得此代码之前已对其进行了解码。



希望它有所帮助。
You might want to look at transferring-byte-array-from-soap-service-to-android[^]

Like in the pointer I can't see if the data received is encoded or even if you have decoded it before you get to this code.

Hope it helps.


这篇关于如何将图像从wcf ksoap2传输到android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆