title: How to return a specific field from WEB SERVICE SOAP for Android
body: <p>I need to return a specified field from my SOAP web service:</p>
  
  <p>class MainActivity:</p>
  
  <pre><code>package com.example.paulogabriel.test_app;
  
  public class MainActivity extends Activity implements View.OnClickListener {
  
      private Button btn_login;
      private EditText mUser;
      private EditText mPass;
      private EditText amountEdit;
      private EditText resultEdit;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Button button = (Button)findViewById(R.id.login);
          button.setOnClickListener(this);
      }
  
  
      public void onClick(View view) {
          EditText mUser = (EditText) findViewById(R.id.usuario);
          EditText mPass = (EditText) findViewById(R.id.senha);
          //amountEdit = (EditText) findViewById(R.id.amount_edit);
          resultEdit = (EditText) findViewById(R.id.TESTE);
          String CGC = "82270711000140";
          String ENTIDADE = "0";
          String RETORNO = null;
          String SENHA = mPass.getText().toString();
          String TIPO = null;
          String USERNAME = mUser.getText().toString();
          wsconnect service = new wsconnect();
          String result = service.Convert(CGC, ENTIDADE, RETORNO, SENHA, TIPO, USERNAME);
          resultEdit.setText(result);
          System.out.println(result);
      }
  }
  </code></pre>
  
  <p>class wsconnect:</p>
  
  <pre><code>package com.example.paulogabriel.test_app;
  
  import org.ksoap2.serialization.SoapObject;
  
  import org.ksoap2.SoapEnvelope;
  import org.ksoap2.serialization.SoapObject;
  import org.ksoap2.serialization.SoapPrimitive;
  import org.ksoap2.serialization.SoapSerializationEnvelope;
  import org.ksoap2.transport.HttpTransportSE;
  
  public class wsconnect {
      private static final String SOAP_ACTION = "http://*********/acessoportal.apw/VALIDALOGIN";
      private static final String METHOD_NAME = "VALIDALOGIN";
      private static final String NAMESPACE = "http://************/acessoportal.apw";
      private static final String URL = "http://*************/ws/WEB015AP.apw?WSDL";
  
      public String Convert(String CGC, String ENTIDADE, String RETORNO, String SENHA, String TIPO, String USERNAME) {
          SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
          request.addProperty("CGC", CGC);
          request.addProperty("ENTIDADE", ENTIDADE);
          request.addProperty("RETORNO", RETORNO);
          request.addProperty("SENHA", SENHA);
          request.addProperty("TIPO", TIPO);
          request.addProperty("USERNAME", USERNAME);
  
          SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
          envelope.dotNet = true;
          envelope.setOutputSoapObject(request);
          try {
              HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
              androidHttpTransport.call(SOAP_ACTION, envelope);
              SoapPrimitive result = (SoapPrimitive) envelope.getResponse();
              return result.toString();
          } catch (Exception e) {
              return e.getMessage();
          }
      }
  }
  </code></pre>
  
  <p>This is my webservice:</p>
  
  <pre><code> &lt;VALIDACESSO&gt;
      &lt;CGC&gt;STRING&lt;/CGC&gt;
      &lt;ENTIDADE&gt;STRING&lt;/ENTIDADE&gt;
      &lt;MENSAGEM&gt;STRING&lt;/MENSAGEM&gt;
      &lt;NOME&gt;STRING&lt;/NOME&gt;
      &lt;NOMECGC&gt;STRING&lt;/NOMECGC&gt;
      &lt;RETORNO&gt;STRING&lt;/RETORNO&gt;
      &lt;USERNAME&gt;STRING&lt;/USERNAME&gt;
   &lt;/VALIDACESSO&gt;
   &lt;VALIDACESSO&gt;
      &lt;CGC&gt;STRING&lt;/CGC&gt;
      &lt;ENTIDADE&gt;STRING&lt;/ENTIDADE&gt;
      &lt;MENSAGEM&gt;STRING&lt;/MENSAGEM&gt;
      &lt;NOME&gt;STRING&lt;/NOME&gt;
      &lt;NOMECGC&gt;STRING&lt;/NOMECGC&gt;
      &lt;RETORNO&gt;STRING&lt;/RETORNO&gt; &lt;---- This is the field i need to return to string result.
      &lt;USERNAME&gt;STRING&lt;/USERNAME&gt;
   &lt;/VALIDACESSO&gt;
  </code></pre>