title: How to Call a WebService in titanium using javascript
body: <p>I am new to titanium and and want to call a web service from my titanium app.
  The webService returns the json response.
  As I am aware of calling the webService using <code>XMLRPC</code> but very confused regarding json.</p>
  
  <p>Until now, I know that we have to create the <code>HTTPClient</code>.</p>
  
  <pre><code>var request = Titanium.Network.createHTTPClient();
  request.open("POST", "http://test.com/services/json");
  request.onload = function() {
      var content = JSON.parse(this.responseText);//in the content i have the response data
  };
  
  request.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); //did not understand this line
  request.send();
  </code></pre>
  
  <p>Now the problem is if my url(endpoints) have many WebServices, so where i will give the method name i.e WS name which is to be called.</p>
  
  <p>From the API documentation of Titanium mobile the function <code>open</code> i.e. <code>request.open</code> accepts 3 parameters: </p>
  
  <ol>
  <li><p>method name (http method name)</p></li>
  <li><p>url of request</p></li>
  <li><p>async (boolean property) by default true.</p></li>
  </ol>
  
  <p>In the above code what is <code>"POST"</code> doing there?? and if my WS name is <code>system.connect</code> then where i will be mentioning that in code?</p>
  
  <p>And what if the WS needs parameter, so how can we send the parameter to the webService form the above code.</p>
  
  <p>I know that <code>request.send()</code> can be used to send parameter but how ??</p>