Question

My Code:

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

import android.util.Log;
import android.widget.Toast;

public class CallSoap {
    public final String SOAP_ACTION = "http://tempuri.org/SendMessage";

    public final String OPERATION_NAME = "SendMessage";

    public final String WSDL_TARGET_NAMESPACE = "http://tempuri.org/";

    public final String SOAP_ADDRESS = "http://omega-solutions.in/ExpertsApp.asmx";

    public CallSoap() {
    }

    public String Call(String deviceid, String msg) {
        SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,
                OPERATION_NAME);
        PropertyInfo pi = new PropertyInfo();
        pi.setName("deviceid");
        pi.setValue(deviceid);
        pi.setType(String.class);
        request.addProperty(pi);
        pi = new PropertyInfo();
        pi.setName("msg");
        pi.setValue(msg);
        pi.setType(String.class);
        request.addProperty(pi);

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

        envelope.setOutputSoapObject(request);

        HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
        Object response = null;
        try {



            httpTransport.call(SOAP_ACTION, envelope);






            response = envelope.getResponse();
            Log.e("after", "" + "after");
        } catch (Exception exception) {

            Log.e("before", "" + "before" + exception.toString());
            response = exception.toString();
        }
        return response.toString();
    }
}

When i run this code

httpTransport.call(SOAP_ACTION, envelope);

I am getting java.io.ioException after above line of code.

Was it helpful?

Solution

Please check the web method of your web service whether you have closed the connection or not.Because I have also faced the same problem but after closing the sql connection of my web method in my web service it has been resloved.... al the best.!!!!!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top