Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I will send the request it will be gone but when response will be back that time it will be showing the invalid resonse i dont understand why it show this error

What I have tried:

androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive resultee=(SoapPrimitive)envelope.getResponse();
System.out.println("Your Soap Based WebService is "+ resultee);
// Get the SoapResult from the envelope body.
SoapObject result = (SoapObject) envelope.bodyIn

private class MyAsyncTask extends AsyncTask<String,Void,String>
    {

        @Override
        protected String doInBackground(String... params)
        {
            SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);

            PropertyInfo infoEmail=new PropertyInfo();
            infoEmail.setName("authkey");
            infoEmail.setType(String.class);
            infoEmail.setValue(params[0].toString());
            request.addProperty(infoEmail);

            PropertyInfo infoPassword=new PropertyInfo();
            infoPassword.setName("username");
            infoPassword.setType(String.class);
            infoPassword.setValue(params[1].toString());
            request.addProperty(infoPassword);

            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            envelope.dotNet = true;
            envelope.setOutputSoapObject(request);
            HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
            try {
                //Thread.sleep(5000);
                //  AndroidHttpTransport
                //this is the actual part that will call the webservice
                androidHttpTransport.call(SOAP_ACTION, envelope);
                SoapPrimitive resultee=(SoapPrimitive)envelope.getResponse();
                System.out.println("Your Soap Based WebService is  "+ resultee);
                // Get the SoapResult from the envelope body.
                SoapObject result = (SoapObject) envelope.bodyIn;



                if (result != null) {
                    //Get the first property and change the label text
                    ReturnResult = result.getProperty(0).toString();
//String msg=resultee.toString();
                    //    Toast.makeText(LoginActivity.this, msg, Toast.LENGTH_LONG).show();
                }
            } catch (Exception e) {
                e.printStackTrace();
                return e.toString();
            }

            return ReturnResult;
        }

        @Override
        protected void onPostExecute(String s)
        {

            if(s.equalsIgnoreCase("Usercode") && (s.equalsIgnoreCase("Password"))){
                Intent MyHomeActivity=new Intent(MainActivity.this,Login.class);
                MyHomeActivity.putExtra("GetUsername",editTextUsername);
                startActivity(MyHomeActivity);
                finish();
            }
            else {
                Toast.makeText(getApplicationContext(), "User Name or Password inccorret", Toast.LENGTH_LONG).show();
                // Hide the progress bar
                //  progressBar.setVisibility(View.GONE);
            }

        }
Posted
Updated 20-Dec-20 22:27pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900