Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6834883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:09:57+00:00 2026-05-26T23:09:57+00:00

I have implemented an Android code that calls a SOAP web service. The web

  • 0

I have implemented an Android code that calls a SOAP web service. The web service takes a String parameter in the form “abc#bcd#efg#”. When I pass such a String I get warnings as follows:

Note this:
ArrayList items2 = new ArrayList();

From logcat:

   11-15 17:44:35.511: INFO/System.out(304): arr2 is ann
   11-15 17:44:35.511: INFO/System.out(304): [ann]
   11-15 17:44:35.511: INFO/System.out(304): absent students are
   11-15 17:44:35.511: INFO/System.out(304): ann#
   11-15 17:44:35.511: INFO/System.out(304): arr2 is john
   11-15 17:44:35.511: INFO/System.out(304): [ann, john]
   11-15 17:44:35.521: INFO/System.out(304): absent students are
   11-15 17:44:35.521: INFO/System.out(304): ann#john#
   11-15 17:44:35.521: DEBUG/(304): items:
   11-15 17:44:35.521: DEBUG/string is(304): ann
   11-15 17:44:35.521: DEBUG/string is(304): john
   11-15 17:44:37.121: WARN/System.err(304): java.lang.ClassCastException:  org.ksoap2.serialization.SoapPrimitive
   11-15 17:44:37.121: WARN/System.err(304):     at com.example.display.call2(display.java:237)
   11-15 17:44:37.133: WARN/System.err(304):     at com.example.display$3.onClick(display.java:196)
   11-15 17:44:37.133: WARN/System.err(304):     at android.view.View.performClick(View.java:2408)
   11-15 17:44:37.133: WARN/System.err(304):     at android.view.View$PerformClick.run(View.java:8816)
   11-15 17:44:37.133: WARN/System.err(304):     at android.os.Handler.handleCallback(Handler.java:587)
   11-15 17:44:37.133: WARN/System.err(304):     at android.os.Handler.dispatchMessage(Handler.java:92)
   11-15 17:44:37.133: WARN/System.err(304):     at android.os.Looper.loop(Looper.java:123)
   11-15 17:44:37.133: WARN/System.err(304):     at android.app.ActivityThread.main(ActivityThread.java:4627)
   11-15 17:44:37.151: INFO/System.out(304): A is 

Due to this the application runs but still I do not get the response intended

My Android code:

 //Button code to insert checkbox value 

alertDialog.setNegativeButton("Mark absent", new DialogInterface.OnClickListener()
    {
    public void onClick(DialogInterface dialog, int whichButton) 
    {

      final Button markabsent = (Button) findViewById(R.id.Button02);
      markabsent.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {

            // Perform action on click
             Toast.makeText(display.this,"You have marked the students absent",Toast.LENGTH_SHORT).show();

             SparseBooleanArray checkedabsent = lView.getCheckedItemPositions();



            for (int i = 0; i < arr2.length; i++) 
            {
                if (checkedabsent.get(i)) 
                {
                    System.out.println("arr2 is "+arr2[i]);
                    items2.add(arr2[i]);
                    System.out.println(items2);
                    s.append(arr2[i] + "#");

                    x=s.toString();
                    //s.deleteCharAt(s.length()-1);


                    System.out.println("absent students are\n" +s);


                }
            }           

            Log.d("", "items:");
            for (String string : items2)
            {
             Log.d("string is", string);   
            }


          }
      });  

    }
    });  

     alertDialog.show();

//Button to call web service    
      final Button submit = (Button) findViewById(R.id.Button03);
      submit.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v)
          {

            // Perform action on click
              Toast.makeText(display.this,"You have selected to submit data of students",Toast.LENGTH_SHORT).show();
              ProgressDialog dialog = new ProgressDialog(display.this);

              String a=call2(x);
              System.out.println("A is "+a);

              dialog.setMessage("Submitting data...");
              dialog.show();
              if(a.equalsIgnoreCase("success"))
              startActivity(new Intent(display.this,End.class));

          }

      });          



         }

//web service calling method ksoap used 
 public String call2(String x)
 {

    String b=""; 

     SoapObject request = new SoapObject(namespace, method_NAME);      
     request.addProperty("names",x.toString());

     SoapSerializationEnvelope envelope = new  SoapSerializationEnvelope(SoapEnvelope.VER11); 
             envelope.dotNet = true; 
             envelope.setOutputSoapObject(request);

             AndroidHttpTransport android = new AndroidHttpTransport(url);

             android.debug = true; 

             try 
             {

                android.call(soap_ACTION, envelope);

                SoapPrimitive res = (SoapPrimitive) envelope.getResponse();
                SoapObject result = (SoapObject)envelope.getResponse();
                Log.i("myapp",result.toString());
                System.out.println(" --- response ---- " + res); 
                b=result.toString();


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


                return b;       

 }

my web service code:

  //splitting received array from android app and storing each value in database
         public String getnames(String names)
    {

        SqlConnection myConnection = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=student;User ID=sa;Password=123");

        try
        {
            String[] s = names.Split('#');
            myConnection.Open();

            SqlCommand myCommand = new SqlCommand();
            myCommand.Connection = myConnection;

            foreach (string a in s)
            {

                myCommand.CommandText = "insert into record2(studentnames) values('"+a+"')";
                myCommand.ExecuteNonQuery();


            }


        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
        finally
        {
            myConnection.Close();
        }

        return "success";
       }

     }    

Please help me solve the problem. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:09:58+00:00Added an answer on May 26, 2026 at 11:09 pm

    I think the error is (line 236) in

    SoapObject result = (SoapObject)envelope.getResponse();
    

    If so then try using this solution:-

    SoapObject result = (SoapObject)envelope.bodyIn;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented a web service(.asmx) using .NET framework that returns me a hash
I have implemented an HTTPOperations class in Android that can successfully produce an HTTP
Here's the deal: I have an Android application that needs to call a web
Problem Description I'm writing module for Android (JAVA) that use native code (C) .
I have a drawing application in Android that allows the user to draw with
I implemented on Android a small application that sends through a socket connection strings
I am new to android and i have been analyzing the android source code
n00b here (first Android project). I have been given a custom video codec that
I have a javascript interface implemented in Java that is called by my javascript
I have an application that runs an activity with a service in a separate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.