I always have a tough time deploying a Flash/Flex based app that uses web services. And we use web services (or similar) on almost all projects! Every two or three months I come across a new problem with web service deployment and have to spend some long hours finding and fixing it. The post describes my latest encounter with webservice errors and the fundamental lessons I’ve learnt about debugging PHP web services used in Flash/Flex/OpenLaszlo.
So, my latest web service error message was:
Request implements version: http://schemas.xmlsoap.org/soap/envelope/ Response implements
Well, that’s the only part I could read in the Alert message I had setup for faults in the web service. This was followed by the famous “could not connect to endpoint” error.
I was surprised looking at the error. First thing I did was check the WSDL file. (Yes, am using SOAP webservices). Tried different ways to generate the WSDL from Zend Studio (I use PHP5 web services and Zend Studio for development). Nothing worked. BTW, the problem came only on the live server. The development and staging servers were working perfectly fine with the same files!
After solving the problem, I re-learnt the biggest lesson in web service debugging.
Root cause of almost all web service related problems is some error / warning in your PHP (or other) code.
In this case, the server was not able to include classes and other files that the webservice was using. My PHP based test cases helped solve the problem since they showed up the include errors PHP was having. So let me give you the lesson # 2.
Make sure you write PHP test cases for your web services.
These test cases will use the SoapClient class to call a method on your webservice. Display all errors in the test cases and you will be able to nail the source pretty quickly.
This one is yet unsolved for me! I want to find out a good web service debugger. Something that allows me to pass arguments to the web service and see the entire request and response – including HTTP headers. The WebOrb admin panel does a great job at that, but I would like something that can easily handle complex data! Anything you know of?
Here are some earlier problems I have had with Webservices:
You would be better off using Coldfusion rather than PHP: web services are *much* easier to implement!