$client = new SoapClient($url);
and this
var_dump($client->__getFunctions());
shows the function prototypes correctly. So it connects and gets the data but when I try to call a function I receive this error
Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in MyFile.php:23 Stack trace: #0 [internal function]: SoapClient->__doRequest('__call('myFunction', Array) #2 …
I made fast research and found that people receive this error when their php installation isn’t right or because they are trying to use it with https without the openSSL extension. So you can receive this problem with various situations. Anyway my code was right so I took a look at the service description that I received from the server and there was the problem. The server wasn’t configured right
<service name='myService'> ... <soap:address location='http://some_other_url'/> .. </service>
It was configured to send invalid url and the function calls were using that invalid url. So there are two solutions - one correct and one that is almost correct but it works for testing purposes when you wait for people to fix their server. So the first is to configure the server correctly. The other is to give __doReguest the correct location.
I hope this will help somebody because founding the problem was very frustrating for me.
3 comments:
Well, in my case this was true.
Hi, can you type a sample-code for a correct __doRequest since we can't alter the server because its ohter companie.
the php.net website didn't work out for me (yet)
thx
i was facing the same issue
check the solution here
http://eaziweb.blogspot.com/2012/05/php-soap-client-uncaught-soapfault.html
Post a Comment