Web Services can convert your application into a platform independent Web-application. You can call web services using mobile applications (e.g iPhone, BB or android). The basic Web Services platform is XML & HTTP. To create web services you should know XML & HTML.
What are Web Services?
- Web services are application components
- Web services communicate using open protocols
- Web services are self-contained and self-describing
- Web services can be discovered using UDDI (Universal Description, Discovery and Integration)
- Web services can be used by other applications
Web services platform elements are as follows:
- SOAP (Simple Object Access Protocol)
- UDDI (Universal Description, Discovery and Integration)
- WSDL (Web Services Description Language)
Creating web service in PHP:
Using NuSoap library you can create web service in PHP.
Step1. WSDL configuration :
$server = new soap_server();
Step2. Register method :
Step3. Writing PHP function :
if($_SERVER['PHP_AUTH_USER']==”test” and $_SERVER['PHP_AUTH_PW']==”supp0rt”) // check for user &
passwd $msg = “valid user”;
else $err = “Invalid user”; // XML to return response
$strOP = “”; $strOP .= “”;
$strOP .= “”.htmlentities($err).”";
$strOP .= “”.htmlentities($msg).”";
$strOP .= “”.htmlentities($amount).”";
$strOP .= “”; // eof XML to return response return $strOP;// return response }
Step4. SOAP response :
Originally posted 2011-08-15 12:57:23.