title: Android, KSoap2 and .NET Web Service w/ parameters = NULL result
body: <p>Apparently this is a fairly often experienced issue. I'm not sure entirely where the problem lies, or what needs to be adjusted, but for the life of me I cannot retrieve anything other than a NULL result to my SoapObject or SoapPrimitive from my .NET XML web service with parameters.</p>
  
  <p>I've tried everything I've found on the net:</p>
  
  <ul>
  <li>Adding the .setXmlVersionTag = no change</li>
  <li>Using SoapObject instead of SoapPrimitive = no change</li>
  <li>Using SoapPrimitive instead of SoapObject = no change</li>
  <li>Using HttpTransportSE instead of AndroidHttppTransport = no change</li>
  <li>Using AndroidHttpTransport instead of HttpTransportSE = no change</li>
  <li>Setting .dotNet = true = no change</li>
  <li>Removing .dotNet assignment line = no change</li>
  <li>Removing the colon (entire HTTP:// prefix) from the web service = no change</li>
  <li>Using the PropertyInfo class instead of direct assignment = no change</li>
  <li>Using direct assignment instead of the PropertyInfo class = no change</li>
  </ul>
  
  <p>I'm at a total loss and it's quite frustrating. I have total control of the web service (I wrote it) so minor changes, if helpful, I'm willing to attempt.</p>
  
  <p>Currently my code as follows is this:</p>
  
  <pre><code>public void GetResults()
  {
  SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
  request.addProperty("lastName", "sm");
  request.addProperty("middleName", "");
  request.addProperty("firstName", "");
  request.addProperty("pageSize", 25);
  request.addProperty("pageNumber", 1);
  
  SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);           
  soapEnvelope.dotNet = true;
  soapEnvelope.setOutputSoapObject(request);
  
  //AndroidHttpTransport aht = new AndroidHttpTransport(URL);
  HttpTransportSE aht = new HttpTransportSE(URL);
  
  try
  {
      aht.setXmlVersionTag("&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;");
      aht.call(SOAP_ACTION, soapEnvelope);           
  
      //SoapObject result = (SoapObject)soapEnvelope.bodyIn;
      SoapObject result = (SoapObject)soapEnvelope.getResponse();
      //SoapPrimitive result = (SoapPrimitive) soapEnvelope.getResponse();
      //Object result = soapEnvelope.getResponse();
  
      Log.d("WS", String.valueOf(result));          
  }
  catch(Exception e)
  {
      e.printStackTrace();
  }       
  }
  </code></pre>
  
  <p>and my globals look like this:</p>
  
  <pre><code>private static final String SOAP_ACTION = "http://yoda/SearchPerson";
  private static final String METHOD_NAME = "SearchPerson";
  private static final String NAMESPACE = "http://yoda/";
  private static final String URL = "http://yoda/ws.asmx";
  </code></pre>
  
  <p><strong>I know 'yoda' is translating correctly as my non-parameterized web serivce is working like a bloody champ.</strong> (Everything is identical save the 'request.addProperty' calls which are obviously (part or all) of the issue at hand.)</p>
  
  <p>If it matters I'm writing this against a 1.6 target platform with KSoap2 2.5.2 and it behaves identically across all my different Android emulators.</p>
  
  <p>I've sniffed the packets with wireshark and the emulator appears to be sending the correct stuff but the results it receives are always NULL.  (I've tested these exact parameters many times against my test web site that uses these web services, and all is working perfectly there.)</p>
  
  <p>So, can anyone throw me a bone here?</p>
  
  <p>Thanks,</p>
  
  <p>Magua</p>
  
  <p><strong>EDIT 2010.11.28:</strong></p>
  
  <p>Even though Wireshark is telling me that I'm sending the parameters it would seem that the web service isn't receiving them correctly, or something similar.  I created a whole new service that was suppose to return a simple string, whatever the first parameter was, with " TEST" at the end, hardcoded from the web service itself.</p>
  
  <p>Well, every time I run this (from Android) I do get a result, and it is always " TEST".  No matter how I formulate the SoapEnvelope or no matter what I pass as the parameter, I always receive " TEST".  Of course when I invoke the web service on the server it works like a champ (and my result is "THIS IS A TEST").</p>
  
  <p>My web service is on Windows Server 2008 with IIS 7.  The application pool is running against framework v2.0 (not v4.0) with 'Integrated' managed pipeline mode.</p>
  
  <p>I have no idea where the disconnect lies.  Is KSoap2 sending the parameters improperly?  Is IIS configured incorrectly?  Something else entirely?</p>