{"id":1349,"date":"2018-01-19T19:22:44","date_gmt":"2018-01-19T19:22:44","guid":{"rendered":"http:\/\/goofy-trucks.flywheelsites.com\/web-services-implementation-using-php-and-soap\/"},"modified":"2018-01-19T19:24:43","modified_gmt":"2018-01-19T19:24:43","slug":"web-services-implementation-using-php-and-soap","status":"publish","type":"post","link":"https:\/\/phpbuilder.com\/web-services-implementation-using-php-and-soap\/","title":{"rendered":"Web Services Implementation using PHP and SOAP"},"content":{"rendered":"<div class=\"phpbuilder-content\">\n<div class=\"phpbuilder-meta\">\n<div class=\"\">By Rajeev Ranjan Rakesh<\/div>\n<div class=\"\">on November 14, 2008<\/div>\n<\/p><\/div>\n<div id=\"overflow-content\">\n<h2>Introduction to Web Services<\/h2>\n<div class=\"articlePara\">\nWeb Services is a system which enables and supports interoperability. It enables applications written in different languages, located in different places, running on different operating systems, to talk to each other, exchange information and perform different operations. The building blocks of Web Services are a<br \/>\nset of XML based standards namely SOAP (Simple Object Access Protocol), WSDL<br \/>\n(Web Services Description Language) and UDDI (Universal Description, Discovery,<br \/>\nand Integration).\n    <\/div>\n<p><center><img decoding=\"async\" src=\"https:\/\/phpbuilder.com\/wp-content\/uploads\/2018\/01\/phpb1.jpg\"\/><\/center><\/p>\n<div class=\"articlePara\">\nThe above diagram is the simplest diagram which can help you visualize web<br \/>\nservices, and shows how two remote applications can interact with each<br \/>\nother using web services. The protocol used for this remote interaction is SOAP.\n    <\/div>\n<h2>Simple Object Access Protocol (SOAP)<\/h2>\n<div class=\"articlePara\">\nSOAP is a lightweight protocol for the exchange of information in a distributed environment. It is an XML-based protocol. The most important aspect of SOAP is its simplicity and extensibility. A SOAP message contains data in the form of XML. SOAP consists of three parts:<\/p>\n<ol>\n<li>It is a framework for describing what is in a message and how to process the message\n<\/li>\n<li>It is a set of Encoding rules\n<\/li>\n<li>It is a convention for representing remote procedure calls (request and response)\n<\/li>\n<\/ol>\n<\/div>\n<h2>PHP and web Services<\/h2>\n<div class=\"articlePara\">\nPHP is a widely used general purpose scripting language. It is basically a procedural<br \/>\nlanguage, but it has the capabilities of an object oriented language also. Its syntax<br \/>\nis similar to Perl, C, Java, etc. It can be very easily embedded in the HTML which<br \/>\nmakes web developement using PHP very easy. Some of the features of PHP which enhanced its capability for Web services development are discussed below.\n    <\/div>\n<div class=\"articlePara\">Object Oriented Programming Capabilities<\/div>\n<div class=\"articlePara\">\n<ul>\n<li>PHP supports XML\n<\/li>\n<li>The CURL Extension of PHP (Client URL Library) allows us to communicate via different protocols such as HTTP, HTTPS, FTP, Telnet, LDAP).\n<\/li>\n<li>The most important feature of PHP is it enables the open source web services implementation.\n<\/li>\n<\/ul>\n<\/div>\n<h2>PHP Web Services using NuSoap<\/h2>\n<div class=\"articlePara\">\nNuSoap is a group of PHP classes that allow us to send and receive SOAP messages over HTTP. You can download this nusoap.php library from <a href=\"http:\/\/www.nusphere.com\/\">http:\/\/www.nusphere.com<\/a>. It is open source, licensed under the GNU LGPL. Once you have downloaded nusoap.php, you simply need to place it anywhere you like on your machine, but don??t forget to include the path of this file while including this file in your php code. I will suggest that you to keep it in the same work folder in which your code is located. To include NuSoap classes in our code:<\/p>\n<p><center><img loading=\"lazy\" decoding=\"async\" width=\"558\" height=\"31\" src=\"https:\/\/phpbuilder.com\/wp-content\/uploads\/2018\/01\/image005-1.gif\"\/><\/center>\n       <\/div>\n<div class=\"articlePara\">\nIf the path of the nusoap.php file (which can be absolute or relative) is incorrect, the above-mentioned code will generate a warning but will continue the processing of??the rest of the code. We can also use below-mentioned function as required.<\/p>\n<ul>\n<li>require() :-it is similar to the include function but it will make the program halt in case of failure.\n<\/li>\n<li>require_once() :- it is similar to require(), it won??t include the file if it has already been included.\n<\/li>\n<li>include_once() :- similar to include(), it wont include if the file is already included.\n<\/li>\n<\/ul>\n<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Web Services is a system which enables and supports interoperability. It enables applications written in different languages, located in different<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1349","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1349","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/comments?post=1349"}],"version-history":[{"count":1,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1349\/revisions"}],"predecessor-version":[{"id":2174,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/posts\/1349\/revisions\/2174"}],"wp:attachment":[{"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/media?parent=1349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/categories?post=1349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phpbuilder.com\/wp-json\/wp\/v2\/tags?post=1349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}