Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using NuSoap works on local machine but not server

Tags:

php

nusoap

I've developed some code which uses the NuSoap classes for PHP to call a soap web-service. I'm using NuSoap rather than the PHP 5 native classes mainly because I don't want to add an extra prerequisite when this code is installed on a shared web server. The code works fine on my machine:

require DOCROOT.'modules/nbn_species_dict_sync/lib/nusoap.php';
$client = new nusoap_client('http://www.nbnws.net/ws_3_5/GatewayWebService?wsdl', true);
$query1 = '<TaxonReportingCategoryListRequest xmlns="http://www.nbnws.net/TaxonReportingCategory" registrationKey="'.$key.'"></TaxonReportingCategoryListRequest>';
$response = $client->call('GetTaxonReportingCategoryList', $query1);

When I put this up on a virtual server rather than running it locally, the last line just hangs for about 10 seconds then PHP bombs out. No exception is raised and there is no PHP error (I've tried using try..catch and set_error_handler just to be sure).

My first reaction was that this might be a firewall running on the server blocking outgoing requests, but I am successfully using cUrl elsewhere for requests and I am pretty sure there is no firewall running here. Calling $client->use_curl does not make any difference to the NuSoap call though, it still does not work.

Any ideas why this might be occurring would be much appreciated.

like image 802
Johnvb Avatar asked Oct 11 '11 10:10

Johnvb


1 Answers

If you're out of troubleshooting ideas, and assuming you are running on Linux, you can watch the system calls by using strace. The calls can look pretty cryptic, but sometimes you can see what system call its hanging on, then Google that call for more info.

strace -p processid

Or if you want to trace your script from start of execution to finish and dump to an output file:

strace -o trace.txt myscript.php

Here is a good strace tutorial.

like image 164
Banjer Avatar answered Sep 27 '22 18:09

Banjer