title: nusoap codeigniter webservice server and client
body: <p>I am new in webservice, and have been looking in how to create web service, at the moment, I think I somehow manage to make one but it does not return any result. I am using nusoap and also Codeigniter.</p>
  
  <p>The WebService Server is in an application called <code>WebServiceTester</code></p>
  
  <p>below is the code for the <code>Bills_WS</code> controller that serve as the server:</p>
  
  <pre><code>class Bills_WS extends CI_Controller
  {
      function __construct() 
      {
          parent:: __construct ();         
      }
  
      public function index()
      {
         $this-&gt;load-&gt;library('Nusoap_lib');
  
         $namespace = "http://localhost:8080/webservicetester/bills_ws.php?wsdl";
  
         $server = new nusoap_server;
         $server-&gt;configureWSDL('WebServiceTester');
         $server-&gt;wsdl-&gt;schemaTargetNamespace = $namespace;
  
         $server-&gt;register('hello');
  
         $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
         $server-&gt;service($HTTP_RAW_POST_DATA);
      }
      function hello()
      {
          return "greetings from server";
      }
  }
  </code></pre>
  
  <p>and to call it, I am calling it in another application(same machine) called ussccsv1 under ws_client library that is being used in transaction controller:</p>
  
  <pre><code>class Ws_client
  {
      private $CI = null;
      function __construct() 
      {
          $this-&gt;CI =&amp; get_instance();
      }
  
      public function transaction_send_ws($param)
      {
          $this-&gt;CI-&gt;load-&gt;library('nuSoap_lib');
  
          $url = 'http://localhost/webservicetester.php/bills_ws?wsdl';  
  
          $client = new nusoap_client($url);
          $response = $client-&gt;call('hello');
  
          if($client-&gt;fault)
          {
              echo "FAULT:".$client-&gt;faultcode;
              echo "string: ".$client-&gt;faultstring;
          }
          else
          {
              $r = $response;
              count($r);
  echo "count".count($r);
  
          }
      }
  }
  </code></pre>
  
  <p>I am also including the <code>nusoap_lib</code> I am using:</p>
  
  <pre><code>class Nusoap_lib
  {
      function nusoap_lib()
      {
          include(APPPATH.'libraries/nusoap/nusoap'.EXT); 
      }
  }
  </code></pre>
  
  <p>my questions are:
   1. How do I invoke the webservice in the <code>bills_ws</code> ? is the <code>$url</code> correct? coz so far it gives me 404 error HTTP not found.
   2. Is the fault in <code>ws_client</code> or <code>bills_ws</code>?
   3. but it gives me a <code>count($r)</code>  in <code>ws_client = 1</code> when i echo it.</p>
  
  <p>Been trying to follow this tutorial, but I don't seem to understand it fully:
  -<a href="http://www.phpeveryday.com/articles/PHP-Web-Services-Fetching-Data-From-Database-P105.html" rel="nofollow">http://www.phpeveryday.com/articles/PHP-Web-Services-Fetching-Data-From-Database-P105.html</a>
  -<a href="http://ellislab.com/forums/viewthread/59710/" rel="nofollow">http://ellislab.com/forums/viewthread/59710/</a></p>
  
  <p>Thank you in advance.</p>