What is the best way to implement web services in PHP?
I have heard about libraries like
WSO2 web service platform, but don't know what is the best (or good and easy to learn) for using web service in PHP?
SOAP is certainly not the ONLY way to implement Web services. If you're open to other paradigms, have a look at REST.
Unlike SOAP (which has multiple standards/vendors), REST is both vendor- and protocol-agnostic. Instead, RESTful Web services are implemented using these guidelines (from the Wikipedia article):
A RESTful web service (also called a RESTful web API) is a simple web service implemented using HTTP and the principles of REST. Such a web service can be thought about as a collection of resources. The definition of such a web service can be thought of as comprising three aspects:
* The base URI for the web service, such as http://example.com/resources/ * The MIME type of the data supported by the web service. This is often JSON, XML or YAML but can be any other valid MIME type. * The set of operations supported by the web service using HTTP methods (e.g., POST, GET, PUT or DELETE).
Back to PHP, here is the reference guide for the ZendFramework implementation of REST Server functionality.
Also, here is a link to another answer I gave that references some useful information regarding ZendFramework and REST.
Since PHP 5, there is a built-in SOAP library in PHP. I usually tend to use built-in libraries rather than PHP implementations, as they tend to be faster and stable.
One library I used when not using the built-in one, is Zend_Soap, which is built on top of the built in SOAP and it simplifies working with it.
You can either choose WSDL+SOAP to build your web services, or implement RESTful web services. Either way, you need to understand what is web services and the basic components of it. To me, REST seems more effective.
Here is an example based on Delicious.
Please take a look at PHP and Web Services presentation which covers SOAP, REST and JSON.