I'm new to this android apps, so i developed a sample .net web service app and putted this service in another machine IIS server and calling from there to my system. But i didn't getting response everything looks fine, so 'm placing my code on skydrive so please download my code "Android app and .net service.rar" from below link and check it and tell me what's wrong in that from 2 days i'm struggling with that :(
This is my code...
.net web service code:
[WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{
public Service () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string MobileApp(string type)
{
return "Type is"+type;
}
}
Service call code in eclipse:
public void ServiceCall()
{
try{
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("type",view1.getText().toString());
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.setOutputSoapObject(request);
//@SuppressWarnings("deprecation")
//ndroidHttpTransport androidHttpTransport=new AndroidHttpTransport(URL);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug=true;
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive result = (SoapPrimitive)envelope.getResponse();
TextView txtView=(TextView)findViewById(R.id.txtSer);
txtView.setText(result.toString());
}
catch (final IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (final XmlPullParserException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
} catch (final Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Lines added in manifest:
<uses-permission android:name="android.permission.INTERNET" ></uses-permission>
<uses-sdk android:minSdkVersion="7" />
@nag