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

  • Home
  • SEARCH
  • 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 8060529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:01:17+00:00 2026-06-05T10:01:17+00:00

Right now i have used SOAP method to consume web service from android eclipse.

  • 0

Right now i have used SOAP method to consume web service from android eclipse.

I need to get input from edittext and display the proper values,which means to call the web service and return the result.

After emulator getting run,it shown as “ERROR:java.lang.RuntimeException:Cannot serialize 0004”.How to over come this error.

Here is my code,please find

screen.java

public class X_classActivity extends Activity 
{
    private EditText edit;
    private Button btn; 

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);
         edit = (EditText) findViewById(R.id.editText1); 
         btn = (Button)findViewById(R.id.button1);
         btn.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
                      fun();
             }
         });
   }

private void fun()
{
    //getSOAPResponse() method returns SOAP Response
    SoapObject soapResponseObject = getSOAPResponse(edit.getText());
}

public SoapObject getSOAPResponse(GetChars search)
{
    SoapObject soapObject = new SoapObject("http://tempuri.org/", "GetName");
    soapObject.addProperty("str", search);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(soapObject);
    HttpTransportSE androidHttpTransport = new      HttpTransportSE("http://122.248.240.105:234/Service1.asmx?WSDL");
    try 
    {
         androidHttpTransport.call("http://tempuri.org/GetName", envelope);//call the eb service Method
         Object result = envelope.getResponse();
         System.out.println(" " + result.toString());
         ((TextView) findViewById (R.id.textView2)).setText(""+result.toString());
    } 
    catch (Exception E) 
    {
         E.printStackTrace();
         ((TextView) findViewById (R.id.textView2)).setText("ERROR:"    + E.getClass().getName() + ":" + E.getMessage());
    }
    return soapObject;
   }
}

Logcat

06-01 18:39:56.020: W/KeyCharacterMap(932): No keyboard for id 0
06-01 18:39:56.020: W/KeyCharacterMap(932): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
06-01 18:40:00.510: W/System.err(932): java.lang.RuntimeException: Cannot serialize: 0004
06-01 18:40:00.520: W/System.err(932):  at org.ksoap2.serialization.SoapSerializationEnvelope.writeElement(SoapSerializationEnvelope.java:661)
06-01 18:40:00.520: W/System.err(932):  at org.ksoap2.serialization.SoapSerializationEnvelope.writeProperty(SoapSerializationEnvelope.java:645)
06-01 18:40:00.520: W/System.err(932):  at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:614)
06-01 18:40:00.520: W/System.err(932):  at org.ksoap2.serialization.SoapSerializationEnvelope.writeObjectBody(SoapSerializationEnvelope.java:598)
06-01 18:40:00.520: W/System.err(932):  at org.ksoap2.serialization.SoapSerializationEnvelope.writeElement(SoapSerializationEnvelope.java:655)
06-01 18:40:00.530: W/System.err(932):  at org.ksoap2.serialization.SoapSerializationEnvelope.writeBody(SoapSerializationEnvelope.java:579)
06-01 18:40:00.530: W/System.err(932):  at org.ksoap2.SoapEnvelope.write(SoapEnvelope.java:192)
06-01 18:40:00.530: W/System.err(932):  at org.ksoap2.transport.Transport.createRequestData(Transport.java:74)
06-01 18:40:00.530: W/System.err(932):  at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:58)
06-01 18:40:00.530: W/System.err(932):  at com.x.x.x.X_classActivity.getSOAPResponse(X_classActivity.java:57)
06-01 18:40:00.530: W/System.err(932):  at com.x.x.x.X_classActivity.fun(X_classActivity.java:45)
06-01 18:40:00.530: W/System.err(932):  at com.x.x.x.X_classActivity.access$0(X_classActivity.java:41)
06-01 18:40:00.530: W/System.err(932):  at com.x.x.x.X_classActivity$1.onClick(X_classActivity.java:36)
06-01 18:40:00.530: W/System.err(932):  at android.view.View.performClick(View.java:2408)
06-01 18:40:00.530: W/System.err(932):  at android.view.View$PerformClick.run(View.java:8816)
06-01 18:40:00.530: W/System.err(932):  at android.os.Handler.handleCallback(Handler.java:587)
06-01 18:40:00.530: W/System.err(932):  at android.os.Handler.dispatchMessage(Handler.java:92)
06-01 18:40:00.530: W/System.err(932):  at android.os.Looper.loop(Looper.java:123)
06-01 18:40:00.530: W/System.err(932):  at android.app.ActivityThread.main(ActivityThread.java:4627)
06-01 18:40:00.530: W/System.err(932):  at java.lang.reflect.Method.invokeNative(Native Method)
06-01 18:40:00.530: W/System.err(932):  at java.lang.reflect.Method.invoke(Method.java:521)
06-01 18:40:00.540: W/System.err(932):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-01 18:40:00.540: W/System.err(932):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-01 18:40:00.540: W/System.err(932):  at dalvik.system.NativeStart.main(Native Method)

web method

 public class GetName {
public String GetName(String str){
    return(str);
}    }

Thanks a lot!!..

  • 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-06-05T10:01:19+00:00Added an answer on June 5, 2026 at 10:01 am

    I think You are doing something wrong in this line,

    androidHttpTransport.call("http://tempuri.org/GetName", envelope);//call the eb service Method
    

    I think the 1st argument is wrong. Please see the following code, it works fine for me. Also please export the dependencies hen you build the project. Sometimes it will help you.

        private String METHOD_NAME = "";
        // our webservice method name
        private String NAMESPACE = "http://ws.travel_ceylon.web.org";
        // Here package name in webservice with reverse order.
        private String SOAP_ACTION = NAMESPACE + METHOD_NAME;
        // NAMESPACE + method name
        private static final String URL = "http://192.168.177.130:8080/Travel_Ceylon_Central_Web_Service/services/Travel_Ceylon_Web_Service?wsdl";
    
        // you must use ipaddress here, don’t use Hostname or localhost
    
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            String city = "Matara";
            String im = "Galle Face";
    
            METHOD_NAME = "getLongitude_City";
            try {
                SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
                request.addProperty("city", city);
                SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                        SoapEnvelope.VER11);
                envelope.dotNet = true;
                envelope.setOutputSoapObject(request);
                HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
                androidHttpTransport.call(SOAP_ACTION, envelope);
                Object result = envelope.getResponse();
                ((TextView) findViewById(R.id.txtCityLongitude)).setText(city
                        + " Longitude is : " + result.toString());
    
            } catch (Exception E) {
                E.printStackTrace();
                ((TextView) findViewById(R.id.txtCityLongitude)).setText("ERROR:"
                        + E.getClass().getName() + ":" + E.getMessage());
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Good day! I right now have a function the drags an element from a
Right now I have a function, in a class that is used to listen
Right now I have this SQL query which is valid but always times out:
Right now I have def min(array,starting,ending) minimum = starting for i in starting+1 ..ending
Right now I have double numba = 5212.6312 String.Format({0:C}, Convert.ToInt32(numba) ) This will give
Right now I have something like this in NHibernate: Expression.Like(property, value, MatchMode.Anywhere) and that
Right now we have AD/Exchange to manage all of our users logins/e-mail on-site at
Right now I have been trying to use Launchpad's API to write a small
Right now i have a line of code, in vb, that calls a text
Right now I have the following code working: @UiHandler(usernameTextBox) void onUsernameTextBoxKeyPress(KeyPressEvent event) { keyPress(event);

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.