web services Soap android

1

Inquiry, how to consume a soap service using the KSOAP2 android library, the web service is: link

to use the library: NAMESPACE, URL, METHOD_NAME, and SOAP_ACTION. I do not know exactly what those parameters are.

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("Usuario", "x...x"); 
request.addProperty("Password", "x...x");
request.addProperty("Servicio", "x...x");
request.addProperty("Tipodocumento", "D");
request.addProperty("Nrodocumento", "x...x");

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER10);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

try {
    androidHttpTransport.call(SOAP_ACTION, envelope); 
    System.out.println("Respuesta: " + envelope.getResponse().toString());
...

Thank you.

    
asked by romero32 22.09.2016 в 23:38
source

1 answer

0

I have not used Android for a long time, but I think this could help you, according to the wsdl you share. Those are the constants and a bit of how I once used ksoap2 to consume SOAP services on Android.

 final String NAMESPACE = "AFPrivado";
        final String URL="http://www2.sentinelperu.com/ws/aws_datosfoto.aspx";
        final String METHOD_NAME = "Execute";
        final String SOAP_ACTION = "AFPrivadoaction/AWS_DATOSFOTO.Execute";
 SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

    SoapSerializationEnvelope envelope =
            new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet = false;

    envelope.setOutputSoapObject(request);

    HttpTransportSE transporte = new HttpTransportSE(URL,10000);

    try


 {
        transporte.call(SOAP_ACTION, envelope);

        response =(String) envelope.getResponse();
    }
    catch (Exception e)
    {
        result = false;
        response="";
    }

    return result;
}
    
answered by 13.10.2016 / 19:43
source