Using ksoap (Android) to consume WS php (nusoap)

1

Good morning!

I have a small problem:

The ksoap library is returning me an error when trying to integrate with a nusoap webservice, I am always getting the null return, error:

  

06-07 08: 53: 23,843 3039-3077 / com.example.bomprato.bp E / ContentValues:   Error: Attempt to invoke virtual method 'java.lang.String   java.lang.Object.toString () 'on a null object reference

I do not know if it has to do with the namespace, soap_action, and method_name parameters, which may be configured incorrectly. Below is my ksoap configuration with this data:

   @Override
protected String doInBackground(Void... params) {
    Log.i(TAG, "doInBackground");
    System.out.println("INICIO##########################");
    String SOAP_ACTION = "urn:BomPrato#listaIntro";
    String METHOD_NAME = "Notificacoes.listaIntro";
    String NAMESPACE = "urn:BomPrato";
    String URL = "http://www.artistadaweb.com.br/ws/index.php";
    SoapObject resposta = null;
    InputStream resultado;
    try {

        SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = false;
        envelope.setOutputSoapObject(Request);



        HttpTransportSE ht = new HttpTransportSE(URL);
        ht.debug = true;

        System.out.println("aqui3");
        ht.call(SOAP_ACTION, envelope);
        System.out.println("aqui2");
        resposta = (SoapObject) envelope.bodyIn;
        System.out.println("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXaqui1");
       // resposta.getProperty("item");


        System.out.println("RESPOSTAAAAA: "+resposta.getProperty(0).toString());
    } catch (Exception ex) {
        Log.e(TAG, "Error: " + ex.getMessage());
    }
    return "fdsdsfds";
}

Here is the test WS that I'm using (only the methodIntroList that is working for now): link

I'm counting on your help, thanks!

    
asked by anonymous 07.06.2018 / 14:20

0 answers