Location: PHPKode > projects > MembersGear > membersgear/includes/product_webService_client.php
<?php
/*
 *    $Id: client1.php,v 1.3 2007/11/06 14:48:24 snichol Exp $
 *
 *    Client sample that should get a fault response.
 *
 *    Service: SOAP endpoint
 *    Payload: rpc/encoded
 *    Transport: http
 *    Authentication: none
 */
 
require_once "../config/config.php"; 
require_once(INCLUDE_DIR.'/nusoapwebservice/nusoap.php');

class ProductWebserviceClient
{

    var $moClient; 
    
    function __construct()
    {
        $proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
        $proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
        $proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
        $proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
        $useCURL = isset($_POST['usecurl']) ? $_POST['usecurl'] : '0';

        $this->moClient = new nusoap_client("http://localhost:8081/sscMemberSite/includes/product_webService_sever.php?wsdl", true,$proxyhost, $proxyport, $proxyusername, $proxypassword);
         $this->moClient->setEndpoint("http://localhost:8081/sscMemberSite/includes/product_webService_sever.php");
        //$client = new nusoap_client("http://soap.amazon.com/onca/soap2", false,
        //    $proxyhost, $proxyport, $proxyusername, $proxypassword);
        $err = $this->moClient->getError();
        if ($err) {
            echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
            echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
            exit();
        }
        $this->moClient->setUseCurl($useCURL);
    }
    
    function getProductInfo($pId)
    {
        $lsMaster = array('pid'=>$pId);
        $WebServiceResponse = $this->moClient->call('getProductInfo', $lsMaster); 
        
        if ($this->moClient->fault) 
            return false;
        else
        {
            $lErr = $this->moClient->getError();
            if($lErr)
                return false;
        }
        
        return $WebServiceResponse;
      
    }
    
}


//echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
//echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
//echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(), ENT_QUOTES) . '</pre>';
 $prod=new ProductWebserviceClient();
 $val= $prod->getProductInfo(9); 

?>
Return current item: MembersGear