title: Connecting to WCF with KSOAP2 - XmlPullParserException position END_DOCUMENT
body: <p>I have developed a WCF Service .NET4 and I am trying to connect to it from Android(1.6). But when i try to connect all i get is "org.xmlpull v1 xmlpullparserexception unexpected type (position: END_DOCUMENT null@1:0 in java.io.InputStreamReader@4396aa90)" error.. I've already checked METHOD_NAME , NameSpace, URL , Soap_Action and look fine for me. Also i tried with System.setProperty("http.keepAlive", "false") and changing SoapEnvelope.VER from 10 to 12 but still nothing.. Any suggestions?<br>
    My code:</p>
  
  <pre><code>package web.service;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  import android.widget.TextView;
  
  import org.ksoap2.*;
  import org.ksoap2.serialization.*;
  import org.ksoap2.transport.*;
  import org.w3c.dom.Text;
  
   public class WebServiceConnActivity extends Activity {
  
  private static final String NAMESPACE = "http://tempuri.org/" ;
  private static final String URL = "http://10.0.2.2:51599/Service.svc";
  //private static final String URL = "http://10.0.2.2:51599/MyWCFApp/Service.svc";
  private static final String Add_SOAP_ACTION = "http://tempuri.org/IService/HelloWorld";
  private static final String METHOD_NAME1 = "HelloWorld";
  
  
  
  public TextView tView;
  public Button btn;
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      tView = (TextView)findViewById(R.id.tView);
      btn = (Button)findViewById(R.id.btn);
  
      btn.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
              GetAdd();
          }
      });
  
  }
  
  
  public void GetAdd() 
  {
  
      SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1);
  
      //request.addProperty("value1", "2");
      //request.addProperty("value2", "3");
  
      SoapSerializationEnvelope envelope =
      new SoapSerializationEnvelope(SoapEnvelope.VER11);
      envelope.dotNet = true;
      envelope.setOutputSoapObject(request);
      HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
      System.setProperty("http.keepAlive", "false");
      try
      {
          androidHttpTransport.call(Add_SOAP_ACTION, envelope);
          //java.lang.String receivedInt = (String)envelope.getResponse();
          Object result = (Object)envelope.getResponse();
  
          tView.setText(result.toString());
  
      }
      catch(Exception e)
      {
          tView.setText(e.toString());
      }
  
  }  
  }
  </code></pre>
  
  <p>I've spent little more time on this problem and here's what come into my mind:
  The problem is probably in URL - I've developed WS .NET3.5 and all works just fine, and only difference is URL:</p>
  
  <pre><code>private static final String URL = "http://10.0.2.2:50915/aspWebService/Service.asmx";
  </code></pre>
  
  <p>But I have no clue where i could make mistake in WCF's URL. I took URL from WDSL and i just change "localhost" to "10.0.2.2", the address <a href="http://10.0.2.2:51599/Service.svc" rel="nofollow">http://10.0.2.2:51599/Service.svc</a> is visible from emulators browser.
  Here is part of my WDSL file with URL(i suppose):</p>
  
  <pre><code>&lt;wsdl:service name="Service"&gt;
  &lt;wsdl:port name="WSHttpBinding_IService" binding="tns:WSHttpBinding_IService"&gt;
  &lt;soap12:address location="http://localhost:51599/Service.svc"/&gt;
  &lt;wsa10:EndpointReference&gt;
  &lt;wsa10:Address&gt;http://localhost:51599/Service.svc&lt;/wsa10:Address&gt;
  &lt;Identity&gt;
  &lt;Dns&gt;localhost&lt;/Dns&gt;
  &lt;/Identity&gt;
  &lt;/wsa10:EndpointReference&gt;
  &lt;/wsdl:port&gt;
  &lt;/wsdl:service&gt;
  </code></pre>
  
  <p>Any hints?</p>