Hi , I am trying to download a bitmap from a web service ( created
in .Net ). My web service consists of a method "GetImage" , which will
return a bitmap stored in my local machine.Everything works fine,
except when I try do decode the response byte into a bitmap. I have
attached the source code. any sort of help is greatly appreciated.
public class HelloWeb extends Activity {
private static final String SOAP_ACTION = "http://webservice.org/
GetImage";
private static final String METHOD_NAME = "GetImage";
private static final String NAMESPACE = "http://webservice.org/";
private static final String URL = "http://10.1.26.21/Webservice/
Service1.asmx";
private Object resultRequestSOAP = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//TextView tv = new TextView(this);
ImageView tv = new ImageView(this);
setContentView(tv);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope
(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject( request );
HttpTransportSE transport = new HttpTransportSE(URL);
try
{
transport.call(SOAP_ACTION, envelope);
resultRequestSOAP = envelope.getResponse();
String results = resultRequestSOAP.toString();
byte[] bresult = results.getBytes(); //
everything is fine upto this point
Bitmap bitmap ;
bitmap = BitmapFactory.decodeByteArray(bresult , 0,
bresult .length); //here I get a null bitmap
ImageView img = (ImageView) findViewById
(R.id.ImageView01);
img.setImageBitmap(bitmap);
}
catch (Exception aE)
{
aE.printStackTrace ();
}
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---