Ok, here is my Problem:
I am sending a soap-Request and i get a valid answer, everything is correctly working and i get the valid output within the responsedump. But calling evelope.getResponse() in:
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
//adding parameters
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.setAddAdornments(false);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject so = (SoapObject) envelope.getResponse();
throws this exception:
Caused by: java.lang.NullPointerException
at org.ksoap2.serialization.SoapSerializationEnvelope.getResponse(SoapSerializationEnvelope.java:521)
the Error is within the getResponse from the source of ksoap2:
/** * Response from the soap call. Pulls the object from the wrapper object and returns it. * * @since 2.0.3 * @return response from the soap call. * @throws SoapFault */
public Object getResponse() throws SoapFault {
if (bodyIn instanceof SoapFault) {
throw (SoapFault) bodyIn;
}
KvmSerializable ks = (KvmSerializable) bodyIn; <-- Line 521
if (ks.getPropertyCount()==0) {
return null;
} else if(ks.getPropertyCount()==1) {
return ks.getProperty(0);
} else {
Vector ret = new Vector();
for(int i=0;i<ks.getPropertyCount();i++){
ret.add(ks.getProperty(i));
}
return ret;
}
}
try this instead of SoapObject
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();