Thursday, September 25, 2014

Free Android Game: Mouse Up

Download URL:

Wednesday, July 16, 2014

PHP SoapClient error: Could not connect to host

It is a mystery why this piece of code caused a SoapFault exception:
  $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.

Saturday, July 5, 2014

Create a Web Service from a WSDL with Eclipse

  1. Create an empty Dynamic Web Project (New->Project...->Web->Dynamic Web Project).
  2. Important Note: In the "Dynamic Web Project" dialogue, select a version less than 3.0 for the Dynamic web module version, e.g. 2.5. Otherwise, we will get an error of Apache Axis2 Web service runtime in Tomcat v7.0 Server does not support the service project <MyProject> in a later step.
  3. Right click on the project and select New->Others...
  4. In the "Select a wizard" dialogue, select Web Services->Web Service, and click the "Next" button.
  5. Select Top down Java bean Web Service for the Web Service type option. Input the URL of the web service in the Service definition box.
  6. Drag the slider on the left to choose Start service. Click the "Next" button.
  7. Follow the prompts to create the web service and start Tomcat.
  8. The web service skeleton is generated and we can fill in our implementation of the business logic.
Get This <