use of org.ksoap2.serialization.KvmSerializable in project ETSMobile-Android2 by ApplETS.
the class Helper method convertToHeader.
public static Element convertToHeader(Object obj, String namespace, String name) {
Element parentElement = new org.kxml2.kdom.Element().createElement(namespace, name);
if (obj == null) {
return parentElement;
}
if (obj instanceof KvmSerializable) {
KvmSerializable soapObject = (KvmSerializable) obj;
for (int i = 0; i < soapObject.getPropertyCount(); i++) {
PropertyInfo info = new PropertyInfo();
soapObject.getPropertyInfo(i, new Hashtable(), info);
info.setValue(soapObject.getProperty(i));
Element el1 = convertToHeader(info.getValue(), info.getNamespace(), info.getName());
parentElement.addChild(Node.ELEMENT, el1);
}
} else {
String value = obj.toString();
parentElement.addChild(org.kxml2.kdom.Node.TEXT, value);
}
return parentElement;
}
use of org.ksoap2.serialization.KvmSerializable in project ETSMobile-Android2 by ApplETS.
the class ExtendedSoapSerializationEnvelope method writeObjectBody.
@Override
public void writeObjectBody(XmlSerializer writer, KvmSerializable obj) throws IOException {
if (obj instanceof AttributeContainer) {
AttributeContainer soapObject = (AttributeContainer) obj;
int cnt = soapObject.getAttributeCount();
for (int counter = 0; counter < cnt; counter++) {
AttributeInfo attributeInfo = new AttributeInfo();
soapObject.getAttributeInfo(counter, attributeInfo);
writer.attribute(attributeInfo.getNamespace(), attributeInfo.getName(), attributeInfo.getValue() != null ? attributeInfo.getValue().toString() : "");
}
}
super.writeObjectBody(writer, obj);
}
Aggregations