About edit texts and buttons on consuming webservice from android eclipse

I am consuming web service using the method SOAP.I have to create an edit text box and a button on android eclipse,which should be similar to this webservice Here i wanna to display some text in android eclipse by consuming web service ie.The edittextbox should get input from the user and print exactly what the above webservice is going to display. I have tried but its not working.Can anyone let me know ideas or some sample code if you have.

Thanks for your Precious Time!..

Answers


Manick, Specify your question what you want to do? you have a edittext and a button and webservice data. When you type in edittext and click on button no of webservice data should be listed as per user inputs. OR anything else. Try this

Ok Let's see!

First you have to download KSOAP Library for your project from here a lightweight and efficient SOAP client library for the Android platform. Add this library to your project. Following code will help you -

private Button button1;
private EditText editText1;

public void onClick(Bundle b){
    ........//type your other code here

    editText1 = (EditText) findViewById(R.id.editText1);        
    button1 = (EditText) findViewById(R.id.button1);
    button.setOnClickListener(this);

    ........//type your other code here
}

@Override
public void onClick(){
    SoapObject soapResponseObject = getSOAPResponse(editText1.getText());
    String result= soapResponseObject.getProperty(0).toString();
    //use result to into your code to your own way
    Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT).show();
}

//getSOAPResponse() method returns SOAP Response 
public SoapObject getSOAPResponse(String search){
    SoapObject soapObject = new SoapObject("http://www.webservicex.net", "GetBibleWordsbyKeyWord");
    soapObject.addProperty("BibleWords", search);
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
    envelope.dotNet = true;
    envelope.setOutputSoapObject(soapObject);
    HttpTransportSE androidHttpTransport = new HttpTransportSE("http://www.webservicex.net/BibleWebservice.asmx?");
    try {
    androidHttpTransport.call("http://www.webserviceX.NET/GetBibleWordsbyKeyWord", envelope);//call the eb service Method
    } catch (Exception e) {
        e.printStackTrace();
    }
    return (SoapObject) envelope.response();
}

Hope this will help you. Fun!


Need Your Help

Android slow soft keyboard opening

android android-fragments keyboard android-softkeyboard soft-keyboard

I have a really annoying problem. A made registration form in android and when an EditText get focus the keyboard comes up. But its really slow. It takes 5 sec or more even on high-end devices.

git describe: inexplicable commit count

git git-flow smartgit git-tag git-describe

Consider this excerpt of git log --oneline --decorate --graph: