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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:37:56+00:00 2026-05-30T12:37:56+00:00

I am using ksoap2 library for connecting to a wcf web service. When I

  • 0

I am using ksoap2 library for connecting to a wcf web service. When I try to send primitive types, server gets these values and send a correct response. However, if I try to send a complex type ( an object that is a subtype of KVMSerilizable ) the server receives null.
Below is the class definition of the object that I want to send.

import java.util.Hashtable;

import org.ksoap2.serialization.KvmSerializable;
import org.ksoap2.serialization.PropertyInfo;

public class TwoIntegerWrapper implements KvmSerializable {

    private int Num1;
    private int Num2;

    public TwoIntegerWrapper() {
        super();
    }

    TwoIntegerWrapper(int number1, int number2) {
        super();
        this.Num1 = number1;
        this.Num2 = number2;
    }

    public int getNumber1() {
        return Num1;
    }

    public void setNumber1(int number1) {
        this.Num1 = number1;
    }

    public int getNumber2() {
        return Num2;
    }

    public void setNumber2(int number2) {
        this.Num2 = number2;
    }

    public Object getProperty(int propertyNumber) {

        Object property = null;

        switch (propertyNumber) {
        case 0:
            property = this.Num1;
            break;

        case 1:
            property = this.Num2;
            break;

        }

        return property;
    }

    public int getPropertyCount() {
        return 2;
    }

    public void getPropertyInfo(int propertyNumber, Hashtable arg1,
            PropertyInfo propertyInfo) {

        switch (propertyNumber) {
        case 0:
            propertyInfo.type = PropertyInfo.INTEGER_CLASS;
            propertyInfo.name = "Num1";
            break;
        case 1:
            propertyInfo.type = PropertyInfo.INTEGER_CLASS;
            propertyInfo.name = "Num2";
            break;
        }

    }

    public void setProperty(int propertyNumber, Object data) {
        switch (propertyNumber) {

        case 0:
            this.Num1 = Integer.parseInt(data.toString());
            break;
        case 1:
            this.Num2 = Integer.parseInt(data.toString());
            break;
        }

    }
}

And here is how I call web service.

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

PropertyInfo property = new PropertyInfo();
TwoIntegerWrapper tiw = new TwoIntegerWrapper(num1Value, num2Value);

property.setName("TwoIntegerWrapper");
property.setType(tiw.getClass());
property.setValue(tiw);

request.addProperty(property);

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

envelope.addMapping(NAMESPACE, tiw.getClass().getSimpleName(), TwoIntegerWrapper.class);

HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;

try {
    androidHttpTransport.call(Add_SOAP_ACTION, envelope);

    Log.d(logtag + " request dump", androidHttpTransport.requestDump);
    Log.d(logtag + " response dump", androidHttpTransport.responseDump);


   SoapPrimitive sp = (SoapPrimitive) envelope.getResponse();
   result = Integer.parseInt(sp.toString());
}

What are the possible reasons?

  • 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-30T12:37:57+00:00Added an answer on May 30, 2026 at 12:37 pm

    I found the solution by changing getPropertyInfo function of TwoIntegerWrapper class. I also set namespaces for each property in this class. The new implementation is the following:

    public void getPropertyInfo(int propertyNumber, Hashtable arg1,
            PropertyInfo propertyInfo) {
    
        switch (propertyNumber) {
        case 0:
            propertyInfo.type = PropertyInfo.INTEGER_CLASS;
            propertyInfo.name = "Num1";
            propertyInfo.setNamespace(TWO_INTEGER_WRAPPER_NAMESPACE);
            break;
        case 1:
            propertyInfo.type = PropertyInfo.INTEGER_CLASS;
            propertyInfo.name = "Num2";
            propertyInfo.setNamespace(TWO_INTEGER_WRAPPER_NAMESPACE);
            break;
        }
    
    }
    

    Even if I remove mapping from the envelope, it works. I could not understand why it is so, but it works. I appreciate if someone explains the reason. Wsdl file, xsd0, xsd1 and xsd2 files are in the link http://www.ceng.metu.edu.tr/~e1559897/

    By the way, I also changed

    property.setName("TwoIntegerWrapper");  
    

    to

    property.setName("obj");  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using ksoap2 to operate an azure web service, and the service uses
Calling a .net SOAP1.1 web service from android using ksoap2 lib I met a
I'm using ksoap2 for web service method calls. I used ksoap2-android-assembly-2.5.4-jar-with-dependencies.jar and was able
I'm using ksoap2-android to make a call to wcf service over SSL. I can
I'm using KSOAP2 to invoke a web service. I am getting a response, but
I have an Android app that fetches data from the web service using ksoap2,
i am using following webservices for retrieving data from server server side:.net client side:ksoap2
has any one been able to connect to a soap server using ksoap2 android
I'm using KSoap within my Android application. My application using Web Service for communicate
I am using KSoap2 for calling web-services for my Android app. I am using

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.