Ibraheem Osama Mohamed (ابراهيم اسامه محمد)

Welcome to my blog :)

Android and KSOAP

leave a comment »

Consuming a web service in a .net language is very easy. so if you want to consume a web service in android that will be hard ?? of course no but you must know very well what will you do exactly
Lets start This is the Code for consuming the web service we used a library KSOAP2 for SE not FOR ME
if you are consuming it using a WCF so you must say the it is a .net “every thing is in the code”
also if you typed the url like that you’ll get an error cause the android emulator is using this port so use change the 1 in the last of the port number to 2 🙂
the last thing you must specify the method name as you wrote it in the Web Service ex : my method was taking a string m so I wrote in the addProperty(“m”,”//here the object you want to send”)
Good luck 🙂 

try {
    // TODO Auto-generated method stub
    SoapObject request = new SoapObject("http://tempuri.org/""GetCoursesInfos");
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    HttpTransportSE http = new HttpTransportSE("");
      http.call("http://tempuri.org/IService1/GetCoursesInfos", envelope);
      Object result= (Object)envelope.getResponse();

    catch (Exception e) {
      // TODO Auto-generated catch block
      Log.d(“1”“first exe”);

Ibraheem Osama Mohamed
Twitter : @IbraheemOsamaMo 

Written by Ibraheem Osama Mohamed

May 9, 2012 at 10:27 am

Posted in android, java, Ksoap, web service

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: