title: NuSoap with CakePHP, error black-holed
body: <p>I am trying to create a webservices using cakePHP and nusoap, when I test this code outside of cakePHP this code works done, but inside of cakephp I have a error black-holed:</p>
  
  <p>error.log</p>
  
  <pre><code>2015-04-17 14:24:32 Error: [BadRequestException] The request has been black-holed
  Request URL: /epedidos/Soap/?wsdl=
  Stack Trace:
  #0 C:\xampp\htdocs\epedidos\lib\Cake\Controller\Component\SecurityComponent.php(239): SecurityComponent-&gt;blackHole(Object(SoapController), 'auth')
  #1 [internal function]: SecurityComponent-&gt;startup(Object(SoapController))
  #2 C:\xampp\htdocs\epedidos\lib\Cake\Utility\ObjectCollection.php(128): call_user_func_array(Array, Array)
  #3 [internal function]: ObjectCollection-&gt;trigger(Object(CakeEvent))
  #4 C:\xampp\htdocs\epedidos\lib\Cake\Event\CakeEventManager.php(242): call_user_func(Array, Object(CakeEvent))
  #5 C:\xampp\htdocs\epedidos\lib\Cake\Controller\Controller.php(675): CakeEventManager-&gt;dispatch(Object(CakeEvent))
  #6 C:\xampp\htdocs\epedidos\lib\Cake\Routing\Dispatcher.php(187): Controller-&gt;startupProcess()
  #7 C:\xampp\htdocs\epedidos\lib\Cake\Routing\Dispatcher.php(165): Dispatcher-&gt;_invoke(Object(SoapController), Object(CakeRequest))
  #8 C:\xampp\htdocs\epedidos\app\webroot\index.php(108): Dispatcher-&gt;dispatch(Object(CakeRequest), Object(CakeResponse))
  #9 {main}
  </code></pre>
  
  <p>and this is appears in my screen(out of cakephp to test web services function)</p>
  
  <pre><code>HTTP Error: Unsupported HTTP response status 400 Bad Request (soapclient-&gt;response has contents of the response)
  Error on contructor
  
  1
  </code></pre>
  
  <p>It is my Controller:</p>
  
  <pre><code>App::uses('HttpSocket', 'Network/Http');
  App::import('Vendor','soap/lib/nusoap');
  
  class SoapController extends AppController {
  
      public $components = array('Security', 'RequestHandler');
      public $useTable = false;
  
      public function index() {
          $this-&gt;autoRender = false;
          $this-&gt;layout = false;
  
          function doAuthenticate() {
              if (isset($_SERVER['PHP_AUTH_USER']) and isset($_SERVER['PHP_AUTH_PW'])) {
  
                  if ($_SERVER['PHP_AUTH_USER'] == "admin" &amp;&amp; $_SERVER['PHP_AUTH_PW'] == "admin")
                      return true;
                  else
                      return false;
              }
          }
  
          function hello($name) {
              if (!doAuthenticate())
                  return "Invalid username or password";
  
                  $myname    =    "&lt;br/&gt; Well done, &lt;b&gt;" . $name . "&lt;/b&gt;, your web services work!";
                  return $myname;
          }       
  
          $server = new soap_server();
          $server-&gt;configureWSDL("epedidos","urn:epedidos", "http://localhost/epedidos/Soap/?wsdl");
  
          $server-&gt;register("hello",
              array("name" =&gt; "xsd:string"),
              array("return" =&gt; "xsd:string"),
              "urn:epedidos",
              "urn:epedidos#hello",
              "rpc",
              "encoded",
              "hello manolo"
          );
  
          $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
          $server-&gt;service($HTTP_RAW_POST_DATA);
      }
  
      public function beforeFilter(){
          parent::beforeFilter();
  
          $this-&gt;Auth-&gt;Allow('index');
      }
  
  }
  </code></pre>
  
  <p>When I access the url <a href="http://localhost/epedidos/Soap/?wsdl" rel="nofollow noreferrer">http://localhost/epedidos/Soap/?wsdl</a> doesn't show a normal XML, show the description "hello manolo" and 2 fields</p>
  
  <p><img src="https://i.stack.imgur.com/pJjhZ.png" alt="enter image description here"></p>
  
  <p>My client is index.php</p>
  
  <pre><code>require_once("lib/nusoap.php");
  //Create web service client
  
  //$client = new nusoap_client("http://localhost/ws/ws-servidor.php?wsdl", true);    
  $client = new nusoap_client("http://localhost/epedidos/Soap/?wsdl", 'wsdl');
  
  $client-&gt;setCredentials("admin", "admin", "basic");
  
  echo $client-&gt;call('hello', array('name' =&gt; 'teste'));
  
  if($client-&gt;getError()){
      echo '&lt;p&gt;Error on contructor &lt;pre&gt;' . print_r($client-&gt;getError()) . '&lt;/pre&gt;&lt;/p&gt;';
  }
  
  unset($client);
  </code></pre>
  
  <p>Please tell me if I am doing a something wrong and how to solve this problem,</p>
  
  <p>Thanks.</p>