Ksoap Soapenvelope Bodyin y GetResponse () Problema
-
30-10-2019 - |
Pregunta
Estoy usando el siguiente código para llamar a un método por SOAP. Está funcionando perfectamente.
private static final String SOAP_ACTION = "http://tempuri.org/GetAuthenticateUser";
private static final String METHOD_NAME = "GetAuthenticateUser";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://stage.mysite.com/FinancialSnapshotService/Service.asmx?WSDL";
// I have tried http://stage.mysite.com/FinancialSnapshotService/Service.asmx also
public void getResults() {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("vstrUserID", "vk@gmail.com");
request.addProperty("vstrPassword", "password");
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(request);
HttpTransportSE aht = new HttpTransportSE(URL);
try {
aht.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
aht.call(SOAP_ACTION, soapEnvelope);
SoapObject result = (SoapObject) soapEnvelope.getResponse();
Log.d("WS", String.valueOf(result));
} catch (Exception e) {
e.printStackTrace();
}
}
Pero cuando probé el mismo código para usar en otros métodos en el mismo servidor, da ClassCastException: org.ksoap2.SoapFault
. Si cambio la línea SoapObject result = (SoapObject) soapEnvelope.getResponse();
a SoapObject result = (SoapObject)soapEnvelope.bodyIn;
, funciona perfectamente. ¿Puede Aanyone decirme qué es básico de este código, dónde usar? bodyIn
y donde usar getResponse()
?
No hay solución correcta
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow