I have been working on a script with PHP4 that relies on NuSOAP. Now, I'm trying to move this to PHP5, and use the buildin support for SOAP there.
$wsdlPath = ""; // I have obviously set these variables to something meaningful, just hidden for the sake of security
$apiPath = "";
$username = "";
$password = "";
// PHP5 style
$client = new soapclient($wsdlPath, array('login'=>username,
'password'=> $password,
'soap_version'=> SOAP_1_2,
'location'=> $apiPath,
'trace'=> 1));
// PHP4/NuSOAP style
$client = new soapclient($wsdlPath, true);
client->setEndpoint($apiPath);
$client->setCredentials($username, $password);
$client ->loadWSD);
The PHP5-version throws the following exception stacktrace:
EXCEPTION=SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://external-nbb.napi.norwegian.no.stage.osl.basefarm.net/api/napi1300?wsdl' in /home/eisebfog/public_html/database/norwegian.php:31
Stack trace:
#0 /home/eisebfog/public_html/database/norwegian.php(31): SoapClient->SoapClient('http://external...', Array)
#1 /home/eisebfog/public_html/database/index.php(53): require_once('/home/eisebfog/...')
#2 {main}
Now, as the NuSOAP version does work, and the pure PHP5 doesn't - it doesn't take a brain surgeon to figure out I'm doing something wrong. I have access to the .htaccess file, and through phpinfo() I have made sure that I'm running NuSOAP properly and running PHP5 when I should, and PHP4/Nusoap when I should.
Basically, I'm not very good with web services and soap - but if anyone has any ideas, i'd appreciate any input on what I'm doing wrong and how I can move to the native soap in PHP5. Btw, the reson I want this move in the first place is the assumed resource savings in native soap. I'd appreciate any links to benchmarks between these two solutions too.
Make sure NuSoap and PHPv5-SOAP are running on the same server. If I'm not totally wrong, both libraries uses the same class-name. Maybe it will work better if you make sure none NuSopa-files are included? And also verify that the SOAP-library are loaded:
if(!extension_loaded('soap')){
dl('soap.so'); // Actually a deprecated method. See "notes" at http://no.php.net/dl
}
I guess the version-field you refer to is defined as "SOAP 1.1" or similiar?
Best wishes :)
Btw: what are you working on? Exchange of delays from the pilot to the airport? Or perhaps a webservice which will decrease the waiting-time on luggage delivery at Osl? :p