Loading ...
Sorry, an error occurred while loading the content.

NUSOAP problem

Expand Messages
  • saif islam
    Hi I m using nusoap 0.7.3. I found error... ....... Response not of type text/xml: text/html can u pls give me any solution?? client script:
    Message 1 of 1 , Feb 29, 2008
    • 0 Attachment
      Hi I m using nusoap 0.7.3. I found error... .......
      'Response not of type text/xml: text/html'

      can u pls give me any solution??

      client script:

      <?php
      // Pull in the NuSOAP code
       require_once($_SERVER['DOCUMENT_ROOT'].'/ext/nusoap/lib/nusoap.php');
      // Create the client instance
                                  
      //$client = new nusoap_client('http://dev8.pegasus.evoknow.net/testServer.php?wsdl', True);
      $client = new nusoap_client('http://dev8.pegasus.evoknow.net/test.wsdl', True);


      // Check for an error
      $err = $client->getError();
      if ($err) {
          // Display the error   
          echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
          // At this point, you know the call that follows will fail
      }
      // Call the SOAP method
      $result = $client->call('hello', array('name' => 'Scott'));
      //echo 'hi'.$client->getError(); 
      // Check for a fault
      if ($client->fault) {
          echo '<h2>Fault</h2><pre>';
          print_r($result);
          echo '</pre>';
      } else {
          // Check for errors
          $err = $client->getError();
          if ($err) {
              // Display the error
              echo '<h2>Error</h2><pre>' . $err . '</pre>';
          } else {
              // Display the result
              echo '<h2>Result</h2><pre>';
              print_r($result);
          echo '</pre>';
          }
      }
      // Display the request and response
      //echo '<h2>Request</h2>';
      //echo '<pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
      //echo '<h2>Response</h2>';
      //echo '<pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
      //// Display the debug messages
      echo '<h2>Debug</h2>';
      echo '<pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';
      ?>


      Server Script:

      <?php
      // Pull in the NuSOAP code
      require_once($_SERVER['DOCUMENT_ROOT'].'/ext/nusoap/lib/nusoap.php');
      // Create the server instance
      $server = new nusoap_server();
      // Initialize WSDL support
      $server->configureWSDL('hellowsdl', 'urn:hellowsdl');
      // Register the method to expose
      $server->register('hello',                // method name
         array('name' => 'xsd:string'),         // input parameters
         array('return' => 'xsd:string'),       // output parameters
          'urn:hellowsdl',                      // namespace
          'urn:hellowsdl#hello',                // soapaction
          'rpc',                                // style
          'encoded',                            // use
          'Says hello to the caller'            // documentation
      );
      // Define the method as a PHP function
      function hello($name) {
              return 'Hello, ' . $name;
      }
      // Use the request to (try to) invoke the service
      $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
      $server->service($HTTP_RAW_POST_DATA);
      ?>


      Looking for last minute shopping deals? Find them fast with Yahoo! Search.
    Your message has been successfully submitted and would be delivered to recipients shortly.