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 f开发者_如何学JAVAirst 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.
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.
Can you make sure that www-data has (permission to) access to
DOCROOT.'modules/nbn_species_dict_sync/lib/nusoap.php' ?
Or can you try to copy nusoap to another directory?
Or can you try to run it from command prompt as root user?
By the way, what kind of error/warning are you getting?
精彩评论