2

I am trying to make a login for an android application using kSoap.
Here is my code:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    this.login = (Button) this.findViewById(R.id.btn_sign_in);
    this.login.setOnClickListener(new OnClickListener() {

        @Override
        // action of button
        public void onClick(View v) {

    username= (EditText)findViewById(R.id.txt_username);
    password= (EditText)findViewById(R.id.txt_password);
    String UserName = username.getText().toString();
    String Password = password.getText().toString();

    SoapObject loginRequest = new SoapObject(NAMESPACE, METHOD_NAME);
    loginRequest.addProperty("username", UserName);
    loginRequest.addProperty("password", Password);

    SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    soapEnvelope.dotNet=true;
    soapEnvelope.setOutputSoapObject(loginRequest);
    Log.i("LoginDetail", "Username " + UserName + "Password " + Password);

    HttpTransportSE aht = new HttpTransportSE(URL);
    aht.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

    FakeX509TrustManager.allowAllSSL(); // this class may allow SSL

    try{
        aht.call(SOAP_ACTION, soapEnvelope);
        SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
        Log.i("OUTPUT", resultString.toString());
    }
     catch (XmlPullParserException ex) {
         String msg = ex.toString();
         System.out.println(msg);
         }  

    catch (Exception e){
        e.printStackTrace();
    }    

This is what I get:
04-11 16:01:39.705: INFO/System.out(521): org.xmlpull.v1.XmlPullParserException: unexpected type (position:TEXT You do not have ...@1:50 in java.io.InputStreamReader@44ec2250)

What am I doing wrong?

user702537
  • 21
  • 2
  • Can you provide the rest of the message? What is inside the ellipsis matters. Also, can you paste the soap xml? – James Apr 11 '11 at 16:46
  • Try using my solution related to this question.Please visit this link. http://stackoverflow.com/questions/8136217/passing-string-via-web-service-call-using-ksoap-generating-warnings/8150066#comment10003981_8150066 – Shashank_Itmaster Nov 24 '11 at 05:22

1 Answers1

0

Please refer this

This will solve your problem. It is used to authenticate user using SOAP web service.

Community
  • 1
  • 1
Parth Doshi
  • 4,200
  • 15
  • 79
  • 129