?
Solved

How to turn off warnings when using NUSOAP with PHP 5

Posted on 2010-01-12
3
Medium Priority
?
1,058 Views
Last Modified: 2013-11-18
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

0
Comment
Question by:deve-lopez
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 2000 total points
ID: 26319479
You can turn off deprecated warnings ...

error_reporting(error_reporting() & ~E_DEPRECATED);

should do the trick if placed at the beginning of your code and before you include the nusoap class.
0
 
LVL 40

Assisted Solution

by:Richard Quadling
Richard Quadling earned 2000 total points
ID: 26390229
Also, depending upon the warnings/errors, you could fix the nusoap class.

What errors are you getting?
0
 

Author Closing Comment

by:deve-lopez
ID: 31676274
.
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question