title: android login from ios web service?
body: <p>I'm attempting to connect an <code>Android</code> app to a web service originally designed for <code>iOS</code> and I'm not sure if it's going to be possible. I also did not design this web service so I am looking through this code that isn't mine and just kind of fumbling around. The current web service is written in <code>PHP</code> and uses <code>SOAP</code> and <code>WSDL</code>. If i can connect to this web service I will attempt to use <code>ksoap2</code> unless I find a better alternative. I will be using a lot of links in this post because without them you will be looking at an obnoxious amount of code.  </p>
  
  <p>So anyways here is the problem in a nutshell. I have this list for the web service url's <br>
  <a href="http://pastebin.com/yhcXxNJc" rel="nofollow">URL List</a> <br>and from the looks of that list I need to make my login request to <strong>iphoneview/iphone_get_details.php</strong> which has this inside of it. <br>
  <a href="http://pastebin.com/8vv1Vvxj" rel="nofollow">get_details</a><br>however when I use this code </p>
  
  <pre><code>class LogMeIn extends AsyncTask&lt;String, Void, String&gt; {
      HttpClient client = new DefaultHttpClient();
      HttpPost post = new HttpPost(
              "http://www.fakesite.com/myv2/iphoneview/iphone_get_details.php");
  
      protected String doInBackground(String... urls) {
  
          try {
              username = un.getText().toString();
              password = pw.getText().toString();
              List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(
                      2);
              nameValuePairs
                      .add(new BasicNameValuePair("username", username));
              nameValuePairs
                      .add(new BasicNameValuePair("password", password));
              post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
  
              HttpResponse response = client.execute(post);
              String res = inputStream(response.getEntity().getContent())
                      .toString();
              Log.v("RESPONSE", res);
  
              // if username and password are valid, launch main activity
              if (res.toString() == "1") {
                  Intent logIn = new Intent(getApplicationContext(),
                          Main.class);
                  startActivity(logIn);
              }
              // send the user a message saying the login failed
              else {
                  runOnUiThread(new Runnable() {
                      public void run() {
                          pw.setText("");
                          fail.setText(R.string.fail);
                      }
                  });
              }
          } catch (Exception e) {
              e.printStackTrace();
          }
  
          return null;
      }
  
      protected void onPostExecute(String file_url) {
  
      }
  }
  </code></pre>
  
  <p>all I get back is this for a response</p>
  
  <pre><code>05-25 13:57:21.292: V/RESPONSE(5871): &lt;?xml version='1.0' encoding='UTF-8'?&gt;&lt;!DOCTYPE plist PUBLIC '-//Apple//DTD PLIST 1.0//EN' 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'&gt;&lt;plist version='1.0'&gt;&lt;dict&gt;&lt;key&gt;iId&lt;/key&gt;&lt;string&gt;0&lt;/string&gt;&lt;key&gt;itemChildren&lt;/key&gt;&lt;array&gt;&lt;/array&gt;&lt;/dict&gt;&lt;/plist&gt;
  </code></pre>
  
  <p>I know where this response is coming from, there very bottom of the <strong>iphoneview/iphone_get_details.php</strong>. The problem is I don't know if it's because</p>
  
  <ol>
  <li>I need to be wrapping this in a <code>SOAP</code> request </li>
  <li>I can't use this code</li>
  <li>I'm connecting to the wrong file (doubt it)</li>
  <li>all of the above and/or something else</li>
  </ol>
  
  <p>Now common sense tells me from looking at the current iphone_get_details.php file that I will not be receiving a response of "1" or "true" either way. As a matter of fact that file looks like it sends back a ton of information, when in essence all I want is a "1" or a "true" to make sure I'm properly connected with the correct login information. So if anyone has the time to look this question over I'd be grateful, I understand it's a lot of reading. </p>