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 8680477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:15:42+00:00 2026-06-12T21:15:42+00:00

I tried using this tutorial and document , but I can’t get the entity

  • 0

I tried using this tutorial and document, but I can’t get the entity from response.
Here is my user entity: http://pastebin.com/Exx5Fgt6
The request code:

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

DoubleMarshal marshal = new DoubleMarshal();
marshal.register(envelope);
PropertyInfo userInfo = new PropertyInfo();
userInfo.setName("user");
userInfo.setValue(user);
userInfo.setType(user.getClass());
request.addProperty(userInfo);

envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new   HttpTransportSE(URL);
androidHttpTransport.debug = true;
envelope.addMapping(NAMESPACE, "user", new User().getClass());
                androidHttpTransport.call(SOAP_ACTION, envelope);

Log.i(TAG, "dump Request: " + androidHttpTransport.requestDump);
Log.i(TAG, "dump Response: " + androidHttpTransport.responseDump);

SoapObject response = (SoapObject) envelope.bodyIn;
Log.d(TAG, "Property 0: " +     response.getProperty(0).toString());
Log.d(TAG, "Property 1: " + response.getProperty(1).toString());
Log.d(TAG, "Property 2: " + response.getProperty(2).toString());

// Try pasrsing entity
User userReponse = (User) envelope.bodyIn;
Log.d(TAG, "user name: " + userReponse.username);

The response xml:

  <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://axn12.com">
<SOAP-ENV:Body>
    <ns1:registerUserResponse xmlns:ns1="http://axn12.com">
        <code xsi:type="xsd:int">1</code>
        <desc xsi:type="xsd:string">Success. (Executed time: 0.10681s)</desc>
        <user xsi:type="tns:user">
            <user_id xsi:type="xsd:int">5195</user_id>
            <username xsi:type="xsd:string">xcvx423424c</username>
            <email xsi:type="xsd:string">424242dasdfsadf@gmail.com</email>
            <password xsi:type="xsd:string">e258314984050bb53a9309592c6f96ab</password>
            <salt xsi:type="xsd:string">PXN</salt>
            <id_card xsi:type="xsd:string">Array</id_card>
            <fullname xsi:type="xsd:string">o0</fullname>
            <birthdate xsi:nil="true" xsi:type="xsd:string"/>
            <gender xsi:nil="true" xsi:type="xsd:string"/>
            <address xsi:nil="true" xsi:type="xsd:string"/>
            <country xsi:type="xsd:string">233</country>
            <location xsi:type="xsd:string">0</location>
            <zipcode xsi:nil="true" xsi:type="xsd:string"/>
            <mobile xsi:nil="true" xsi:type="xsd:string"/>
            <is_active xsi:type="xsd:int">0</is_active>
            <is_lock xsi:type="xsd:int">0</is_lock>
            <active_token xsi:type="xsd:string">elPp</active_token>
            <created_date xsi:type="xsd:string">2012-10-11 00:28:36</created_date>
            <point xsi:type="xsd:double">300000</point>
            <gold xsi:type="xsd:double">0</gold>
            <level xsi:type="xsd:int">0</level>
            <level_point xsi:type="xsd:int">0</level_point>
        </user>
    </ns1:registerUserResponse>
</SOAP-ENV:Body>

The Double Marshal:

public class DoubleMarshal implements Marshal {

public Object readInstance(XmlPullParser parser, String namespace, String name,
        PropertyInfo expected) throws IOException, XmlPullParserException {

    return Double.parseDouble(parser.nextText());
}

public void register(SoapSerializationEnvelope cm) {
    cm.addMapping(cm.xsd, "double", Double.class, this);

}

public void writeInstance(XmlSerializer writer, Object obj) throws IOException {
    writer.text(obj.toString());
}

}

The problem is I got error when casting entity user:

 10-11 00:08:23.952: W/System.err(1420): java.lang.ClassCastException: org.ksoap2.serialization.SoapObject cannot be cast to com.org.domains.User
 10-11 00:08:23.963: W/System.err(1420):    at com.org.ducminh.WebServiceActivty$1.run(WebServiceActivty.java:125)
 10-11 00:08:23.963: W/System.err(1420):    at java.lang.Thread.run(Thread.java:856)

Where is my problem?

  • 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-12T21:15:43+00:00Added an answer on June 12, 2026 at 9:15 pm

    Please answer my question then I can accept it. – R4j

    well, ok 🙂

    The bodyIn contains the whole response. You have to get it as SoapObject then get the property User as class User

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried using this: mvn dependency:get -DrepoUrl=http://myserver/artifactory -Dartifact=com.mypackage:my-package-name:1.0.0 However it just downloaded the pom.xml
I tried to do it using this tutorial as a base, but it's throwing
I'm following a tutorial here: http://blog.chariotsolutions.com/2012/01/from-list-to-details-view-using.html I am trying to dynamically bind a click
i've tried using this code and this to make a random quote generator, but
I need a custom widget height. I tried using this Integer.toString(yourWidget.getElement().getOffsetHeight()) but, If I
Can someone show me how to use the System.Numerics.BigInteger datatype? I tried using this
I tried using height: 100% but this makes the div only as high as
I tried to send an email using this class below, but no success, no
I was about to start learning x64 assembly using this tutorial (series) but setting
I have recently begun learning the Win32 API using this tutorial: http://www.winprog.org/tutorial/ (though I'm

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.