title: Android ksoap2 Microsoft Webservice - unable to pass parameters to webservice
body: <p>I am learning how to create an android app and webservice using:
  Eclipse IDE
  ksoap2 version 2.6.5 with dependencies
  Visual studio 2010</p>
  
  <p>my method was to follow this great tutorial: <a href="http://www.youtube.com/watch?v=v9EowBVgwSo&amp;feature=related" rel="nofollow">http://www.youtube.com/watch?v=v9EowBVgwSo&amp;feature=related</a></p>
  
  <p>the tutorial works fine with the w3schools test webservice.</p>
  
  <p>I then attempted to write my own webservice and used the helloworld webservice provided in Visual studio to start me off.  I ammended my code to point at the new webservice (published on my development laptop) and ran it on my handset in debug mode.</p>
  
  <p>the communication with the webservice is fine when calling the HelloWorld() webservice.  it even returns a result from simpleMethod() but it does not include the parameter that I passed it. e.g. when calling simpleMethod, Iam returned the following string: "Hello "</p>
  
  <p>I think this is an issue with the webservice because it works for the w3schools test webservice but I am stuck and would appreciate some help.</p>
  
  <p>my code follows:</p>
  
  <p>Webservice:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.Services;
  
  namespace WMCMobileWebService
  {
      /// &lt;summary&gt;
      /// Summary description for Service1
      /// &lt;/summary&gt;
      [WebService(Namespace = "http://testuri.org/")]
      [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
      [System.ComponentModel.ToolboxItem(false)]
      // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
      [System.Web.Script.Services.ScriptService]
      public class Service1 : System.Web.Services.WebService
      {
  
          [WebMethod]
          public string HelloWorld()
          {
              return "Hello World";
          }
  
          [WebMethod]
          public string simpleMethod(String srt)
          {
              return "Hello " + srt;
          }
      }
  }
  </code></pre>
  
  <p>Android app MainActivity:</p>
  
  <pre><code>package com.clcltd.soaptest;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.widget.TextView;
  
  import org.ksoap2.SoapEnvelope;
  import org.ksoap2.serialization.PropertyInfo;
  import org.ksoap2.serialization.SoapObject;
  import org.ksoap2.serialization.SoapPrimitive;
  import org.ksoap2.serialization.SoapSerializationEnvelope;
  import org.ksoap2.transport.HttpTransportSE;
  
  public class SoapTestActivity extends Activity {
      private static final String SOAP_ACTION = "http://testuri.org/simpleMethod";
      private static final String METHOD_NAME = "simpleMethod";
      private static final String NAMESPACE = "http://tempuri.org/";
      private static final String URL = "http://192.168.2.22/wmcmobilewebservice/Service1.asmx";
      PropertyInfo pi;
      TextView tv, tvc;
      String str;
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          tv = (TextView) findViewById(R.id.textView1);
          tvc = (TextView) findViewById(R.id.textView2);
          SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
  
          str = "Andy";
  
          pi = new PropertyInfo();
          pi.setName("srt");
          pi.setValue(str);
          pi.type = PropertyInfo.STRING_CLASS;
  
          request.addProperty(pi);
  
          SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
          soapEnvelope.dotNet = true;
          soapEnvelope.setOutputSoapObject(request);
  
          HttpTransportSE aht = new HttpTransportSE(URL);
          try{
              aht.call(SOAP_ACTION, soapEnvelope);
              SoapPrimitive resultString = (SoapPrimitive) soapEnvelope.getResponse();
              tv.setText("Status: " + resultString);
              tvc.setText(request.toString());
          }catch (Exception e)
          {
              e.printStackTrace();
              tv.setText("Error" + e.toString());
          }
      }
  }
  </code></pre>
  
  <p>When running the code above, I get the following output on my screen:</p>
  
  <p><em>Status: Hello 
  simpleMethod{srt=Andy; }</em></p>
  
  <p>I would expect the result to be:</p>
  
  <p><em>Status: Hello Andy</em></p>
  
  <p>Any ideas?</p>