Skip to content Skip to sidebar Skip to footer

POST Request From Emulator Of Android To A Server

I am trying to post a single image to server there is one image view and one button I am trying to post image to server on click of the button What i have tried ? MainActivity.

Solution 1:

    final String METHOD_NAME = "ServiceName"; // our
    final String SOAP_ACTION = "http://tempuri.org/ServiceName";
    String result = null;

    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    request.addProperty("IMEI", Imei);
    request.addProperty("asscd", asscd);

    SoapPrimitive response = null;

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                                                    SoapEnvelope.VER11);
                    envelope.dotNet = true;
                    envelope.setOutputSoapObject(request);
                    try {

                                    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

                                    androidHttpTransport.call(SOAP_ACTION, envelope);

                                    response = (SoapPrimitive) envelope.getResponse();
                                                 //here SoapPrimitive is an important part
                                    result = response.toString();

                    } catch (Exception e) {
                                    e.printStackTrace();
                    }


        return result;

Post a Comment for "POST Request From Emulator Of Android To A Server"