English 中文(简体)
2 KSOAP2基数64 网上服务的应急反应
原标题:Android KSOAP2 base64Binary response from .net webservice

Im trying to get a byte[] from a base64Binary field in my android application. i manage to get the data though for some reason the data array is full with values in some places, where the same data array in C# returns positive numbers, for instance:

In C# webservice the byte array might look like 46,0,45..... and in android it looks like 46,0, -112......

how can i get the correct byte array from a base64Binary field with KASOP2?

这是目前使用的法典:

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1);
request.addProperty("Name", sName);
SoapSerializationEnvelope envelope =
  new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);


try
{
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
Object o = envelope.bodyIn;
SoapPrimitive result =  (SoapPrimitive)envelope.getResponse();
//to get the data should be a base
String resultData = result.toString();


} 

页: 1

Any help will be greatly appreciated, Thanks, Totem

最佳回答

Actual my problem was very simple i forgot the servers were c++ therefore byte for the base64 encoding was unsigned, and all the classes i found for java were with byte. just had to remove the signed bit from the read stream like so:

nextByte = (short)(0xFF & (short)buf[offset + i]);
问题回答

I had the exact same problem, then I stepped on this link http://androidcodemonkey.blogspot.com/2010/03/how-to-base64-encode-decode-android.html

我从Robert W. Harder的现场下载了基地64的班级,这是我唯一的做法,就是在班级本身添加我的一揽子定义,以便我能够使用。

注:Imm与Anders 1.6一起工作,我可以假定工作上调。

希望:





相关问题
Apache Commons Codec with Android: could not find method

Today I tried including the apache.commons.codec package in my Android application and couldn t get it running. Android could not find method ord.apache.commons.codec.binary.* and output the following ...

Convert image (jpg) to base64 in Excel VBA?

I need to convert an image inside Excel (or through VBA) to base64 (in the end I will make XML output). How can I do this? Do I need to make a reference to DOM? I´ve been reading this question but ...

How to Decode base 64 data

I have an XML doucment in which there is an tag for image like this if there is an image then the tag would be as follows <thumbnail> <type>IMAGE JPG</type> <data> base64 ...

C# Byte[] to Url Friendly String

I m working on a quick captcha generator for a simple site I m putting together, and I m hoping to pass an encrypted key in the url of the page. I could probably do this as a query string parameter ...

need base64 encode/decode in c

I need a function to encode base64 and a function to decode base64 string in c. I found http://base64.sourceforge.net/b64.c but the functions work on files, not strings, and add line breaks. I need ...

Can we convert a byte array into an InputStream in Java?

Can we convert a byte array into an InputStream in Java? I have been looking on the internet but couldn t find it. I have a method that has an InputStream as argument. The InputStream cph I have is ...

热门标签