title: How to authenticate non-wsdl soap in PHP
body: <p>I used this way to get data from server to client side. but I have a problem
  to authenticate server files.</p>
  
  <p>I want to check username and password before give permission to read data. 
  I tried to that using an extra method but I it doesn't work. </p>
  
  <h2>server</h2>
  
  
  
  <pre class="lang-php prettyprint-override"><code>class MyService
  {
      public function add($x, $y)
      {
          return $x + $y;
      }
  }
  
  $options = array(
      'uri' =&gt; 'http://server/namespace',
      'location' =&gt; 'http://server/location',
  );
  
  $server = new SOAPServer(null, $options);
  $server-&gt;setObject(new MyService());
  $server-&gt;handle();
  </code></pre>
  
  <h2>client side</h2>
  
  <pre class="lang-php prettyprint-override"><code>$options = array(
      'uri' =&gt; 'http://server/namespace',
      'location' =&gt; 'http://server/location',
  );
  $client = new SOAPClient(null, $options);
  echo $client-&gt;add(10, 10);
  </code></pre>