Web services allow sharing of resources and functionality across different websites and platforms through platform-independent exposed functions. There are different methods to implement web services, with SOAP being a common choice that uses XML to encode data and SOAP to transport it between clients and servers. A sample application demonstrates creating a web service that returns zip/postal codes for cities using a PHP SOAP library, calling the service, and handling errors with SOAP faults.