Using SOAP with PHP can be very easy if you do everything right. First your PHP must be configured with --enable-soap. With Windows and WAMP you only need to check PHP > PHP extensions -> php_soap. You can read more about the configuration here http://www.php.net/manual/en/soap.configuration.php but most likely you don’t need to do anything else.
$client = new SoapClient("http://localhost/SomeSoap.wsdl");
$something = $client->SomeFunction();
var_dump($something);
And that’s all.
If you get Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in the row of
$something = $client->SomeFunction();
your problem may be in your soap configuration or something like this.
Java, JSP, JSF, Struts, Hibernate and Ajax from an everyday life. Nothing serious just some thoughts.
Aug 11, 2011
How to stop Skype from using port 80
Its very annoying when you want to use port 80 with apache for example and you must stop Skype, start the service and start Skype again.
Also its annoying when you install WAMP Server and its not working or at least apache is not working because Skype is on port 80 and you’ve totally forgotten about it. If you are little absent minded like me, you may spend even few hours looking for the problem and installing WAMP again.
Open Skype, select Tools from the menu, then Options, go to Advanced Settings and then Connection. There is a checkbox with the text
Use port 80 and 443 as alternatives for incoming connections
Uncheck it and hit Save. That’s it. You may need to restart Skype for the changes to take effect. I hope that this will help you.
Also its annoying when you install WAMP Server and its not working or at least apache is not working because Skype is on port 80 and you’ve totally forgotten about it. If you are little absent minded like me, you may spend even few hours looking for the problem and installing WAMP again.
Open Skype, select Tools from the menu, then Options, go to Advanced Settings and then Connection. There is a checkbox with the text
Use port 80 and 443 as alternatives for incoming connections
Uncheck it and hit Save. That’s it. You may need to restart Skype for the changes to take effect. I hope that this will help you.
PHP - Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in …
I receive this nasty error yesterday and it took me some time to figure out the problem. This line passes without any problems
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
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.
$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.
Subscribe to:
Posts (Atom)
Popular Posts
-
I’ll continue my article about JQuery Effects - with this one. It would be short information on how to make custom JQuery slideshow animati...
-
This tutorial tries to provide fast and easy instructions on getting started with Hibernate. You can download Hibernate from http://www.hibe...
-
I receive this nasty error yesterday and it took me some time to figure out the problem. This line passes without any problems $client = n...
-
JMesa is a very useful open source project.It is a dynamic HTML table that allows you to edit, filter, sort, paginate and export your data....
-
This would be simple and easy tutorial on how to use Apache Struts in Java web projects. What do you need for this tutorial? Java Tomcat...
-
Here is one fast and simple example on how to do FTP file uploads with PHP. < ? php $ ftp_server = "ftp.server.url" ; $ ...
-
This question is somewhat painful for me. Maybe I am too stupid. Anyway, if you want to make tar archive without using exec, for example on ...
-
JQuery is a lightweight JavaScript framework that got a lot of attention lately so I decided to write few rows about it. This post-tutorial...
-
You can use JQuery Effects in many different ways. I'll write few examples just to show how cool and fun is to work with this API. Usi...
-
Fast and easy Hibernate example-tutorial (Part 1) In the first part of this tutorial we met the basic functionality of Hibernate. We store a...