Web & graphic design notes
NuSOAP and proxy server call bug
We were recently playing with NuSOAP library in order to make SOAP calls to a third-party web service which works on a non-standard port. In order to get it to work we used a proxy server. NuSOAP toolkit provides an easy solution to make SOAP calls to WSDL-based services and you can setup everything you need, literally in a few minutes.
Everything you need to make SOAP call via proxy server is to write:
require_once('include/nusoap.php'); define("WEBSERVICE_LINK", 'http://your_webservice_provider/link?wsdl'); $client = new nusoap_client(WSDL_LINK, wsdl); $client->setHTTPProxy('proxy_server' , poxy_port , 'proxy_user' , 'proxy_password');
Fortunately, we have never faced any problems with NuSOAP library before, but this time we discovered some weird activity using SOAP through proxy server authorization. Script couldn’t open socket connection. We found a quick solution at SourceForge forum.
The problem was in the library itself, specifically in the nusoap.php file. In case the forum link is not accessible, please do the following:
file:nusoap.php
class: soap_transport_http
function: connect($connection_timeout=0,$response_timeout=30)
replace code:
// open socket if($connection_timeout > 0) { $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout); } else { $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str); }
with:
// open socket if($connection_timeout > 0) { $this->fp = @fsockopen( $host, $port, $this->errno, $this->error_str, $connection_timeout); } else { $this->fp = @fsockopen( $host, $port, $this->errno, $this->error_str); }
The current version (0.9.5) on SourceForge still contains the wrong code and should be fixed soon...
| Next > |
|---|





