Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Mobile Development
  3. Android
  4. Android User Login from Wbeservice

Android User Login from Wbeservice

Scheduled Pinned Locked Moved Android
wcfandroidcomxmljson
2 Posts 2 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sandeep2014
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • S Sandeep2014

      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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Sandeep2014 wrote:

      the code is not working

      You need to use your debugger to collect more information and explain exactly what not working means.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups