Migrating from NuSOAP to PHP5 SOAP

I am working on a script with PHP4 that relies on NuSOAP. Now I am trying to port this to PHP5 and am using 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 stacktrace exception:

 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 that the NuSOAP version is working, but pure PHP5 is not, the brain surgeon does not need to find out that I am doing something wrong. I have access to the .htaccess file, and through phpinfo () I made sure that I use NuSOAP correctly and run PHP5 when I have to, and PHP4 / Nusoap when I have to.

Basically, I am not very good at web services and soap, but if anyone has any ideas, I would appreciate any information about what I am doing wrong, and about how I can go to the native soap in PHP5. Btw, resonance I want this step to primarily involve saving resources in my own soap. I would appreciate any references to the tests between the two solutions.

+6
soap wsdl php port nusoap
source share
3 answers

Make sure that NuSoap and PHPv5-SOAP are running on the same server. If I'm not completely mistaken, both libraries use the same class name. Maybe it will work better if you make sure that no NuSopa files are included? And also make sure that the SOAP library is loaded:

 if(!extension_loaded('soap')){ dl('soap.so'); // Actually a deprecated method. See "notes" at http://no.php.net/dl } 

I assume that the version field you are referencing is defined as "SOAP 1.1" or similar?

Best wishes:)

Btw: what are you working on? Exchange delays with the pilot at the airport? Or, perhaps, a web service that will reduce the waiting time for baggage delivery in Osl ?: P
+2
source share

Without testing, I have two suggestions:

First, set the error_reporting error as high as possible (before creating SoapClient):

 error_reporting( E_ALL ); 

If something is wrong with server-side authentication, PHP will trigger warnings. In most cases, he will tell you what went wrong.

Secondly: I don't know if you can specify the "location" option along with the wsdl url. Theoretically, wsdl tells your client where the endpoint is located, so you don’t have to worry.

+1
source share

We had very similar problems with the PHP5 embedded SOAP client trying to use the .NET web service. In addition, WSDL parsing failed with an invalid schema. Including schema definitions in one local file did not help.

We gave up trying and switched to NuSOAP, which really worked.

However, NuSOAP is also far from perfect. Right now I am in a situation of running out of memory when parsing 1 MB + answers. Erasing all the nasty debugging code helped a bit, but not radically.

Thus, it seems that at the moment in PHP there is no 100% compatible / functional implementation of the SOAP client.

+1
source share

All Articles