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

Asked

Viewed 39 times

1

good morning!

I’m in a little trouble:

The ksoap library is returning me an error while trying to integrate with a nusoap webservice, I’m always getting 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 don’t know if it has to do with 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";
}

Follow the WS of tests I’m using (only the list methodIntro that is operating for now): http://www.artistadaweb.com.br/ws/index.php

I count on your help, thanks!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.