Ok i have solved this issue, here is how:
I have created a new soap object called TextSoapObject
public class TextSoapObject extends SoapObject {
public static final String TAG = TextSoapObject.class.getSimpleName();
public TextSoapObject(String namespace, String name) {
super(namespace, name);
}
public String text;
public void setText(String text) {
this.text = text;
}
public String getText() {
return text;
}
}
Next i overrided SoapSerialization envelope like this:
public class ValueSerializationEnvelope extends SoapSerializationEnvelope {
public ValueSerializationEnvelope(int version) {
super(version);
}
public static final String TAG = ValueSerializationEnvelope.class.getSimpleName();
@Override
public void writeObjectBody(XmlSerializer writer, KvmSerializable obj) throws IOException {
if (obj instanceof TextSoapObject) {
writer.text(((TextSoapObject) obj).getText());
}
super.writeObjectBody(writer, obj);
}
}
And that's it.
To use this you would do the following:
final TextSoapObject costOfRepairs = new TextSoapObject(namespace, "CostOfRepairs");
costOfRepairs.addAttribute("Currency", getCurrency());
costOfRepairs.setText(getRepairCosts() + "");
root.addSoapObject(costOfRepairs);
EDIT:
This issue has been recognized for the ksoap2 library and addressed here:
http://code.google.com/p/ksoap2-android/issues/detail?id=112
Should be fixed in the next ksoap2 Release.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…