title: PHP soap and namespaces. PHP Fatal error: Class 'Jira\SoapClient' not found
body: <p>We are updating our codebase to use the namespace functionality provided in PHP-5.3+</p>
  
  <p>Previously, our files all lived happily on the webserver in /htdocs/php but now we are separating our scripts, and putting our PHP libraries in /htdocs/php/lib/</p>
  
  <p>In /htdocs/php/lib/ we have a file called Jira.php which we have given a namespace to:</p>
  
  <pre><code>&lt;?php
  # Define a namespace for this library
  namespace Jira;
  
  function create_client($jira_url, $options)
  {
      global $client;
  
      try
      {
              $client = new SoapClient($jira_url, $options);
      }
      catch (Exception $error)
      {
              echo $error -&gt; getMessage() . "&lt;br/&gt;&lt;p style='color:red'&gt; Could not connect to Jira &lt;/p&gt;";
      }
  }
  ?&gt;
  </code></pre>
  
  <p>However, when we try and call this function from a script in /htdocs/php, we are getting the class not found error:</p>
  
  <pre><code>PHP Fatal error:  Class 'Jira\SoapClient' not found
  </code></pre>
  
  <p>This is failing when we try creating the SoapClient object.</p>
  
  <p>I have verified that I have the php-soap package installed in /usr/share/php/SOAP/
  and php_info(); is showing that it is enabled etc.</p>
  
  <p>So presumably this is a problem with the namespace convention. How do we include that class without it throwing an error? </p>
  
  <p>Regards,
  <strong>ns</strong></p>