Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Help, why can't I make any soap call??

Help
Anonymous
2010-02-22
2013-06-06

  • Anonymous
    2010-02-22

    Hi,

    I'm desperately trying to get my first soap example working. I stripped the code down to the bare minimum:

    The server:

    <?php
    // Pull in the NuSOAP code
    require('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);
    ?>
    

    The client:

    <h2>Some headline...</h2>
    <?php
    // Pull in the NuSOAP code
    require('nusoap.php');
    // Create the client instance
    $client = new soapclient('http://dev.badgercomp.com/api/lastServer.php');
    // Call the SOAP method
    $result = $client->call('hello', array('name' => 'Scott'));
    // Display the result
    print_r($result);
    ?>
    

    But nothing happens.
    What could the issue be?

     
  • Vojko Drev
    Vojko Drev
    2010-02-24

    add

    $client->setDebug(1);
    

    and after $client->call add

    echo $client->getDebug();
    

    do you have curl php extension installed?