newbie error creating server, v0.7.3

Help
2010-01-05
2013-06-06
  • denver hick
    denver hick
    2010-01-05

    trying to reference a hello world server directly in the browser returns:

    Notice: Undefined index: content-type in <my webserver>/lib/nusoap.php on line 4209

    Notice: Undefined index: content-type in <my webserver>/lib/nusoap.php on line 4210

    Warning: Cannot modify header information - headers already sent by (output started at <my webserver>/lib/nusoap.php:4209) in <my webserver>/lib/nusoap.php on line 4174

    Warning: Cannot modify header information - headers already sent by (output started at <my webserver>/lib/nusoap.php:4209) in <my webserver>/lib/nusoap.php on line 4174

    Warning: Cannot modify header information - headers already sent by (output started at <my webserver>/lib/nusoap.php:4209) in <my webserver>/lib/nusoap.php on line 4174

    Warning: Cannot modify header information - headers already sent by (output started at <my webserver>/lib/nusoap.php:4209) in <my webserver>/lib/nusoap.php on line 4174

    Warning: Cannot modify header information - headers already sent by (output started at <my webserver>/lib/nusoap.php:4209) in <my webserver>/lib/nusoap.php on line 4174

    Warning: Cannot modify header information - headers already sent by (output started at <my webserver>/lib/nusoap.php:4209) in <my webserver>/lib/nusoap.php on line 4174
    SOAP-ENV:Clientmethod '' not defined in service

    Here is my server.php:

        <?php
        error_reporting(E_ALL);
        ini_set('display_errors', '1');
       
        // Pull in the NuSOAP code
        require_once('lib/nusoap.php');
        // Create the server instance
        $server = new soap_server;
        // Register the method to expose
        $server->register('hello');
        // 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);
        ?>

    thanks in advance!!!

     
  • elkhunter69
    elkhunter69
    2010-01-05

    I think the first line is causing problems, commenting out the line error_reporting(E_ALL); seems to eliminate the error message.  My guess is that it's writing some content to the response and then when NuSoap tries to write the headers it can't because its not the first item written.  Again, just a guess.

     
  • denver hick
    denver hick
    2010-01-05

    thanks for the help!

    I took out the display of the error and I still get:

    SOAP-ENV:Clientmethod '' not defined in service

     
  • denver hick
    denver hick
    2010-01-05

    nevermind, i figured it out.  I needed to define a wdsl in order to have it show up in the browser.  new server.php:

        <?php
        // Pull in the NuSOAP code
        require_once('lib/nusoap.php');
        // Create the server instance
        $server = new soap_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);
        ?>