Web-services in Android using KSOAP

I want to create connection of web-services using KSOAP2,I have already done code and its getting error,So please suggest me where i'm doing wrong.also i need some help in web-service regard,What is namespace,method that we call,soap_action,url and also some about methods that we use in web-services.I have searched lot but haven't found any complete description about web-services

 public class Web_ServicesActivity extends Activity {
    private static String SOAP_ACTION = "http://service.fun2shoot.com/getLive";

    private static String NAMESPACE = "http://service.fun2shoot.com/";
    private static String METHOD_NAME = "getLive";

    private static String URL = "http://119.82.75.91:8084/Fun2Shoot-WebService/Fun2ShootAndroid?wsdl";

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        System.out
                .println("After mail******************************************");
        // Initialize soap request + add parameters
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
        System.out.println("****************After Request call");
        // Use this to add parameters
        // request.addProperty("Parameter","Value");

        // Declare the version of the SOAP request
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                SoapEnvelope.VER11);
        envelope.setOutputSoapObject(request);

        // Needed to make the internet call
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
        try {
            // this is the actual part that will call the webservice
            androidHttpTransport.call(SOAP_ACTION, envelope);
        } catch (Exception e) {
            e.printStackTrace();
        }

        // Get the SoapResult from the envelope body.
        SoapObject result = (SoapObject) envelope.bodyIn;

        if (result != null) {
            TextView t = (TextView) this.findViewById(R.id.tv);
            System.out
                    .println("***************************************Inside null condition");
            // Get the first property and change the label text
            t.setText("SOAP response:\n\n" + result.getProperty(0).toString());
        }

    }
}

Answers


You can add library in Build Path of Your Project and for your reference for creating web service in java use this Tutorial How to create java based web service.

If you have any doubts regarding this or any other doubts you can write me.


Need Your Help

How to disable whole app if the internet connection lost?

ios xcode swift uitableview

I want to disable whole app and make screen like this:

Prevent bowing in CSS3 and jQuery flip animation

javascript jquery html css3

I am combining a CSS3 flip animation with some jQuery growing animation. I am trying to have a div flip and grow to show the back content on the first click and then flip and shrink on the second c...