Link to home
Start Free TrialLog in
Avatar of deve-lopez
deve-lopezFlag for United States of America

asked on

How to turn off warnings when using NUSOAP with PHP 5

Hello!

How can I turn off warnings on per page basis when using NUSOAP with PHP 5?

I have been trying to convert a NuSOAP WS call to a PHP 5 Soap Extension call but no luck there.
Is there a best practices document that describes the steps to follow for a migration from NuSOAP Client to PHP5 SoapClient?

Attached is a sample NuSOAP Client Call that needs to be upgraded to PHP 5 SoapClient.
Any help with that would be greatly appreciated as my attempts have failed so far :-(

Thanks, D.
<?php
/*
 * The code bellow works fine with PHP4 and PHP5 but sends deprecated warnings for PHP5
 * This is a sample NuSOAP code that needs to be translated into PHP5 Soap Extension code 
 * using SoapClient class instead of nusoap_client class.
 * Any help would be greatly appreciated. If you live in the SoCal area I will throw in 
 * Happy Hour drinks ;-)
 */

// This funtion handles the loging part
function sodCall($wsdl, $method, $params) {
    require_once('lib/nusoap.php');
    $sodClient = new nusoap_client($wsdl, true);
    $sodClient->response_timeout = 600;

    if ($_SESSION == "" || time() > $_SESSION) {
        $header = '<wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/xx/secext">
                    <wsse:UsernameToken>
                    <wsse:Username>MYUSERNAME</wsse:Username>
                    <wsse:Password>PASSWORD</wsse:Password>
                    </wsse:UsernameToken>
                    </wsse:Security>';
        $sodResult = $sodClient->call($method, $params,'','',$header);
        $cookies = $sodClient->getCookies();
        $_SESSION = $cookies[0];
    } else {
        $sodClient->setCookie("JSESSIONID", $_SESSION);
        $sodResult = $sodClient->call($method, $params);
    }
    if ($sodResult) {
        $_SESSION = time() + 598; // 10 minute timeout
        return $sodResult;
    }
}

// variable used for the data retrieval selection
$accountid = 'HE3598-1JGJF';

//body of the soap call
$findLead = array(
    "LeadWS_LeadQueryPage_Input" => array(
        "ListOfLead" => array(
            "Lead" => array(
                "AccountId" => "='$accountid'",
                "LeadId" => "",
                "LeadEmail" => "",
                "ContactId" => "",
                "ContactFullName" => ""
            )
        ), "PageSize" => "100"
    )
);

//soap call execution
$findLeadResult = sodCall('wsdl/v2/Lead.wsdl','LeadQueryPage',$findLead);
?>
<pre><?php var_dump($findLeadResult);?></pre>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Richard Quadling
Richard Quadling
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of deve-lopez

ASKER

.