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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:58:32+00:00 2026-06-07T23:58:32+00:00

I’m using kSoap2 to connect to a WCF service from an android device but

  • 0

I’m using kSoap2 to connect to a WCF service from an android device but I get an serialisation error:

Cannot serialize: CompositeType : StringValue = Test, BoolValue = true

Here is the code for the webservice call:

public void call() {
    try {

        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

        CompositeType comp = new CompositeType();
        comp.setProperty(CompositeType.STRING_VALUE, "Test");
        comp.setProperty(CompositeType.BOOLEAN_VALUE, true);
        PropertyInfo pi = new PropertyInfo();
        pi.setName("CompositeType");
        pi.setValue(comp);
        pi.setType(comp.getClass());
        request.addProperty("composite", pi);

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(request);
        envelope.addMapping(NAMESPACE, "CompositeType", (new CompositeType()).getClass());

        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
        androidHttpTransport.debug = true;
        androidHttpTransport.call(SOAP_ACTION, envelope);
        SoapObject result = (SoapObject) envelope.getResponse();

        comp.setProperty(CompositeType.BOOLEAN_VALUE, Boolean.parseBoolean(result.getProperty(0).toString()));
        comp.setProperty(CompositeType.STRING_VALUE, result.getProperty(1).toString());

        sb.append(comp.toString());
    } catch (Exception e) {
        e.printStackTrace();
        sb.append("Error:\n" + e.getMessage() + "\n");
    }

}

And this is my code for the CompositeType class:

public class CompositeType implements KvmSerializable{

public static final int STRING_VALUE = 1;
public static final int BOOLEAN_VALUE = 0;

public String StringValue;
public Boolean BoolValue;

public CompositeType() {
}

@Override
public String toString() {
    return "StringValue = " + StringValue + ", BoolValue = " + BoolValue.toString();
}

@Override
public Object getProperty(int arg0) {
    switch(arg0)
    {
    case STRING_VALUE:
        return StringValue;
    case BOOLEAN_VALUE:
        return BoolValue;
    }

    return null;
}

@Override
public int getPropertyCount() {
    return 2;
}

@Override
public void getPropertyInfo(int index, @SuppressWarnings("rawtypes") Hashtable arg1, PropertyInfo info) {
    switch(index)
    {
    case STRING_VALUE:
        info.type = PropertyInfo.STRING_CLASS;
        info.name = "StringValue";
        break;
    case BOOLEAN_VALUE:
        info.type = PropertyInfo.BOOLEAN_CLASS;
        info.name = "BoolValue";
        break;
    default:break;
    }
}

@Override
public void setProperty(int index, Object value) {
    switch(index)
    {
    case STRING_VALUE:
        StringValue = value.toString();
        break;
    case BOOLEAN_VALUE:
        BoolValue = Boolean.parseBoolean(value.toString());
        break;
    default:
        break;
    }
}


}

I thought objects that implement KvmSerializable can be serialized … Does anyone know how to get it working?

  • 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-07T23:58:34+00:00Added an answer on June 7, 2026 at 11:58 pm

    This reply might be too little and too late, but I have noticed a problem with boolean params.

    I just changed the booleans to ints and my services worked fine! you will also need to set the web service params / objects to use int’s and then convert to bools if you like!

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

Sidebar

Related Questions

Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.