Jump to content

Web service via php Nusoap with proxy


LLeoun

Recommended Posts

Hi all ,

 

The following code  connects with a web service that given a max number returns the prime numbers below that max.

 

So in a server given 10 as a max I get:

Result

 

Array

(

    [GetPrimeNumbersResult] => 1,3,5,7

)

 

And In another server I get:

Fatal error: Call to a member function getError() on a non-object in /var/apache2/htdocs/test/3.php on line 15

Pointing to line 15, which is:

      $err = $proxy->getError();

 

I'm attaching the phpinfo.php for the server that shows the error.. (please change .txt for .rar)

 

Can anyone please tell me what is going on with the second server??

 

Thanks a ton!

 

?php
require_once('lib/nusoap.php');
require_once('lib/class.wsdlcache.php');


        $webservice_username = "";
        $webservice_password = ""; 
        $webServiceURL ="http://www50.brinkster.com/vbfacileinpt/np.asmx?wsdl";

        $client = new nusoap_client($webServiceURL, 'wsdl', '', '', '', '');
                $proxy = $client->getProxy();

        $err = $proxy->getError();

        if ($err) {
                echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
        }
        $session_header = "<UserCredentials xmlns='http://vidzapper.net/Webservice/'><Userid>".$webservice_username."</Userid><Password>".$webservice_password."</Password></UserCredentials>";
        $client->setHeaders($session_header);

$params=array('max'=>'10'); 
        $results = $client->call('GetPrimeNumbers', $params);


try{

        // Check for a fault
        if ($soapCall->fault) {
                echo '<h2>Fault</h2><pre>';
                        print_r($results);
                echo '</pre>';
                die;
        }
        
                echo '<h2>Result</h2><pre>';
                        print_r($results);
                echo '</pre>';
                die;



} catch (SoapFault $exception) { 
        echo '<h2>Exception</h2><pre>';
                print_r($exception);
        echo '</pre>';
        die;
}       



?>

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/194755-web-service-via-php-nusoap-with-proxy/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.