title: Android using ksoap calling PHP SOAP webservice fails: 'procedure 'CheckLogin' not found
body: <p>I'm trying to call a PHP SOAP webservice. I know my webservice functions correctly because I use it in a WPF project succesfully. I'm also building an app in android, using the same webservice.</p>
  
  <p>The WSDL file can be found here: <a href="http://www.wegotcha.nl/servicehandler/service.wsdl" rel="nofollow">http://www.wegotcha.nl/servicehandler/service.wsdl</a></p>
  
  <p>This is my code in the android app:</p>
  
  <pre><code>String SOAP_ACTION = "http://www.wegotcha.nl/servicehandler/CheckLogin";
          String NAMESPACE = "http://www.wegotcha.nl/servicehandler";
          String METHOD_NAME = "CheckLogin";
          String URL = "http://www.wegotcha.nl/servicehandler/servicehandler.php";
          String resultData = "";
  
          SoapSerializationEnvelope soapEnv = new SoapSerializationEnvelope(SoapEnvelope.VER11);
          SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
  
          SoapObject UserCredentials = new SoapObject("Types", "UserCredentials6");
          UserCredentials.addProperty("mail", params[0]);
          UserCredentials.addProperty("password", md5(params[1]));
  
          request.addSoapObject(UserCredentials);
          soapEnv.setOutputSoapObject(request);
  
          HttpTransportSE http = new HttpTransportSE(URL);
          http.setXmlVersionTag("&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;");
          http.debug = true;
  
          try {
              http.call(SOAP_ACTION, soapEnv);
          } catch (IOException e) {
              e.printStackTrace();
          } catch (XmlPullParserException e) {
              e.printStackTrace();
          }
  
          SoapObject results = null;
          results = (SoapObject)soapEnv.bodyOut;
  
          if(results != null)
              resultData = results.getProperty(0).toString();
  
          return resultData;
  </code></pre>
  
  <p>Using fiddler I got the following:
  Android request:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;v:Header /&gt;
  &lt;v:Body&gt;
  &lt;n0:CheckLogin id="o0" c:root="1" xmlns:n0="http://www.wegotcha.nl/servicehandler"&gt;
  &lt;n1:UserCredentials6 i:type="n1:UserCredentials6" xmlns:n1="Types"&gt;
      &lt;mail i:type="d:string"&gt;myemail&lt;/mail&gt;
      &lt;password i:type="d:string"&gt;myhashedpass&lt;/password&gt;
  &lt;/n1:UserCredentials6&gt;
  &lt;/n0:CheckLogin&gt;
  &lt;/v:Body&gt;
  &lt;/v:Envelope&gt;
  </code></pre>
  
  <p>Getting the following response:</p>
  
  <pre><code> Procedure 'CheckLogin' not present
  </code></pre>
  
  <p>My request produced by my WPF app looks completely different:</p>
  
  <pre><code>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
  &lt;s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
  &lt;UserCredentials6 xmlns="Types"&gt;
      &lt;mail&gt;mymail&lt;/mail&gt;
      &lt;password&gt;mypassword&lt;/password&gt;
  &lt;/UserCredentials6&gt;
  &lt;/s:Body&gt;
  &lt;/s:Envelope&gt;
  </code></pre>
  
  <p>After googling my ass off I was not able to solve this problem by myself. It may be possible there are some weird things in my Java code because I changed a lot since. I hope you guys will be able to help me, thanks.</p>
  
  <p>EDIT:</p>
  
  <p>My webservice is of document/literal encoding style, after doing some research I found I should be able to use <code>SoepEnvelope</code> Instead of <code>SoapSerializationEnvelope</code> Though when I replace this I get an error before the try cache block, causing my app to crash.</p>
  
  <p>Error:</p>
  
  <p>11-04 16:23:26.786: E/AndroidRuntime(26447): Caused by: java.lang.ClassCastException: org.ksoap2.serialization.SoapObject cannot be cast to org.kxml2.kdom.Node</p>
  
  <p>Which is caused by these lines:</p>
  
  <pre><code>request.addSoapObject(UserCredentials);
  soapEnv.setOutputSoapObject(request);
  </code></pre>
  
  <p>This may be a solution though, how do I go about this? I found nothing about using a SoapEnvelope instead of a SoapSerializationEnvelope except for this awesome tutorial:</p>
  
  <p><a href="http://ksoap.objectweb.org/project/mailingLists/ksoap/msg00849.html" rel="nofollow">http://ksoap.objectweb.org/project/mailingLists/ksoap/msg00849.html</a></p>