private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://example.com/CRM/Service.svc";
private static final String SOAP_ACTION = "http://tempuri.org/Login";
private static final String METHOD_NAME = "Login";
//calling web services method
String loginresult=callService(username,password,usertype);
//calling webservices
String callService(String a1,String b1,Integer c1) throws Exception {
Boolean flag=true;
do
{
try{
System.out.println(flag);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo pa1 = new PropertyInfo();
pa1.setName("Username");
pa1.setValue(a1.toString());
PropertyInfo pb1 = new PropertyInfo();
pb1.setName("Password");
pb1.setValue(b1.toString());
PropertyInfo pc1 = new PropertyInfo();
pc1.setName("UserType");
pc1.setValue(c1);
System.out.println(c1+"this is integer****s");
System.out.println("new");
request.addProperty(pa1);
request.addProperty(pb1);
request.addProperty(pc1);
System.out.println("new2");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
System.out.println("new3");
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
System.out.println("new4");
try{
androidHttpTransport.call(SOAP_ACTION, envelope);
}
catch(Exception e)
{
System.out.println(e+" this is exception");
}
System.out.println("new5");
SoapObject response = (SoapObject)envelope.bodyIn;
result = response.getProperty(0).toString();
flag=false;
System.out.println(flag);
}catch (Exception e) {
// TODO: handle exception
flag=false;
}
}
while(flag);
return result;
}
///