soap response

sudha
2008-04-17
2013-06-04
  • sudha
    sudha
    2008-04-17

    Hi,

        Iam new to web services. Iam trying to do a small sample webservice using php. everything goes fine but iam not gettting the response from the server.

    here is my client script and server script.

    client.php
    ----------
    <?php
        require_once('lib/nusoap.php');
        $wsdl="http://localhost/soapserver/server.php?wsdl";
        $client=new nusoap_client($wsdl);
       
        $param=array(
                'amount'=>'15.00',
                );
       
            
        $result = $client->call('calculate', $param);

        /* Begin debug */
       
        if(!$err = $client->getError())
            print_r($result);
        else

            echo "Error: ". $err."<br>";

        echo ' Request : <xmp>'. $client->request . '</xmp>';
        echo 'Response : <xmp>'.$client->response . '</xmp>';
       
        /* End debug */
    ?>

    AND HERE is my server.php
    ---------------------------

    <?

        require_once("lib/nusoap.php");

        $ns="http://localhost/soapclient";
       
        $server = new soap_server();
       
        $server->configureWSDL('calculator',$ns);
        $server->wsdl->schemaTargetNamespace=$ns;
       
        $server->register('calculate',
                    array('amount' => 'xsd:string'),
                    array('return' => 'xsd:string'),
                $ns);
       
       
        function calculate($amount)
        {
            $taxcalc=$amount*15;
            return new soapval('return','xsd:string',$taxcalc);
       
        }
        $server->service($HTTP_RAW_POST_DATA);
    ?>

    CAN anyone HELP me.