ProHzen / ksoap2-android

Automatically exported from code.google.com/p/ksoap2-android
0 stars 0 forks source link

Transfer byte arrays from WCF webservice to soap. #41

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Currently I'm using ksoap2-android to transfer data (Objects, Strings, ...) 
from a wcf webservice to the android device. 

Now I want to transfer images from the server using a byte array. The method 
I'm using is:

problem is that the only way 

public byte[] GetFile(string filePath)
{
 ...
}

which produces a SoapPrimitive on the android client. Other SoapPrimitives 
(Int, String) I read with the toString method

int count = Integer.parseInt(soapPrimitive.toString());

but this (not surprisingly) doesn't work for byte array. I'm not even sure if 
that's the correct way to handle SoapPrimitive results but I haven't found any 
other way.

So my question, is there a way to read a byte array with ksoap2-android (or 
even better a Stream?).

Original issue reported on code.google.com by bgmei...@gmail.com on 5 Dec 2010 at 11:52

GoogleCodeExporter commented 8 years ago
I don't know. Maybe post on the mailing list about it.

Original comment by mosa...@gmail.com on 6 Dec 2010 at 10:07

GoogleCodeExporter commented 8 years ago

I'm using the following way to get the byte array.

byteArray = Base64
                                                .decode(soap
                                                                .getProperty(1)
                                                                .toString());

Original comment by kangal...@gmail.com on 13 Dec 2011 at 10:11

GoogleCodeExporter commented 8 years ago
You need to add marshalling for byte encoding with base64. This is now on the 
wiki.

Original comment by mosa...@gmail.com on 30 Apr 2012 at 6:23