質問
I'm trying to use a webservice, where I need to work with ComplexTypes.
This is the output from the Service:
<req i:type="d:String"></req><File i:type="c:base64">MS4wMDE6MTYxHTEuMDAyOjAwHTEuMDAzOjEfMx4yHzAeNB8xHjQfMh0xLjAw
As you can see there is a <req>
node and a <File>
node. The req-node ends before the File-node starts. This is not what I try to accomplish, the File-Node should be inside the req-node. I'm using KSoap, and this is what I've tried:
SoapObject tempObject = soapObject.addProperty("req", "");
SoapObject tempObject1 = soapObject.addProperty("File", File);
SoapSerializationEnvelope soapSerializationEnvelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
How can I add some data to a complex type in KSOAP?
解決
I used ksoap a while ago and I added complex objects to my request with the following code:
public static PropertyInfo createPropertyInfo(String name, Object value, Object type) {
PropertyInfo pi1 = new PropertyInfo();
pi1.setName(name);
pi1.setValue(value);
pi1.setType(type);
return pi1;
}
And this method is called like this:
request.addProperty(createPropertyInfo("complexType", objectOfComplexType, objectOfComplexType.getClass()));
所属していません StackOverflow