It is a mystery why this piece of code caused a SoapFault exception:
$wsdl = "http://myws.toptip.ca/myws.wsdl";
$client = new SoapClient($wsdl, array(
"trace" => 1,
"exceptions" => 1));
$parameters = array("Element1" => "data1", "Element2" => "data2");
$response = $client->myFunction($parameters);
An important fact was that the soap address location inside the WSDL is using a port other than 80, e.g.
The exception was captured in /var/log/httpd/error_log:
PHP Fatal error: Uncaught SoapFault exception: [Http] Could not connect to host in ...
I tried to use Wireshark to capture the packets sent and received. Surprisingly, there was no packet sent out to the server from SoapClient. Not even the attempt to connect.
Accidentally, I found out an interesting thing. When I changed the port number of the soap address location in the WSDL file to the default (80), e.g.
SoapClient actually tried to connect to the service.
Sorry, I don't have the answer. If you have a clue, please let me know.
However, I have a workaround.
I installed the squid proxy on port 80 of the localhost. Then when creating the SoapClient object, I added the "proxy_host" and "proxy_port" options. Bang! It worked!! SoapClient sent the request to the proxy and it was successfully forwarded to the web service location.