Android User Login from Wbeservice
-
I want to login the soap based webservice from android application but the code is not working i tried too much : package com.example.dotnetlogin; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.PropertyInfo; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapPrimitive; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; public class WebService { //Namespace of the Webservice - can be found in WSDL private static String NAMESPACE = "http://tempuri.org/"; //Webservice URL - WSDL File location private static String URL = "http://www.domain.co.in/Service.asmx"; //SOAP Action URI again Namespace + Web method name private static String SOAP_ACTION = "http://www.tempuri.org/GetUserDetails"; public static boolean invokeLoginWS(String username,String passWD, String webMethName) { boolean loginStatus = false; // Create request SoapObject request = new SoapObject(NAMESPACE, webMethName); // Property which holds input parameters PropertyInfo userName = new PropertyInfo(); PropertyInfo password = new PropertyInfo(); // Set Username userName.setName("username"); // Set Value userName.setValue(username); // Set dataType userName.setType(String.class); // Add the property to request object request.addProperty(userName); //Set Password password.setName("password"); //Set dataType password.setValue(passWD); //Set dataType password.setType(String.class); //Add the property to request object request.addProperty(password); // Create envelope SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); // Set output SOAP object envelope.setOutputSoapObject(request); // Create HTTP call object HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); try { // Invoke web service androidHttpTransport.call(SOAP_ACTION+webMethName, envelope); // Get the response SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); // Assign it to boolean variable variable loginStatus = Boolean.parseBoolean(response.toString()); } catch (Exception e) { //Assign Error Status true i
-
I want to login the soap based webservice from android application but the code is not working i tried too much : package com.example.dotnetlogin; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.PropertyInfo; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapPrimitive; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; public class WebService { //Namespace of the Webservice - can be found in WSDL private static String NAMESPACE = "http://tempuri.org/"; //Webservice URL - WSDL File location private static String URL = "http://www.domain.co.in/Service.asmx"; //SOAP Action URI again Namespace + Web method name private static String SOAP_ACTION = "http://www.tempuri.org/GetUserDetails"; public static boolean invokeLoginWS(String username,String passWD, String webMethName) { boolean loginStatus = false; // Create request SoapObject request = new SoapObject(NAMESPACE, webMethName); // Property which holds input parameters PropertyInfo userName = new PropertyInfo(); PropertyInfo password = new PropertyInfo(); // Set Username userName.setName("username"); // Set Value userName.setValue(username); // Set dataType userName.setType(String.class); // Add the property to request object request.addProperty(userName); //Set Password password.setName("password"); //Set dataType password.setValue(passWD); //Set dataType password.setType(String.class); //Add the property to request object request.addProperty(password); // Create envelope SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); // Set output SOAP object envelope.setOutputSoapObject(request); // Create HTTP call object HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); try { // Invoke web service androidHttpTransport.call(SOAP_ACTION+webMethName, envelope); // Get the response SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); // Assign it to boolean variable variable loginStatus = Boolean.parseBoolean(response.toString()); } catch (Exception e) { //Assign Error Status true i