{"id":1884,"date":"2013-06-21T05:22:38","date_gmt":"2013-06-20T19:22:38","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=1884"},"modified":"2013-06-21T05:22:38","modified_gmt":"2013-06-20T19:22:38","slug":"php-web-service-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-web-service-primer-tutorial\/","title":{"rendered":"PHP Web Service Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/WebService\/\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"PHP Web Service Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/PHP\/WebService\/PHP_WebService.jpg\" title=\"PHP Web Service Primer Tutorial\"\/><\/a><p class=\"wp-caption-text\">PHP Web Service Primer Tutorial<\/p><\/div>\n<hr \/>\n<\/hr>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Java\/Eclipse\/WebService\/Primer\/\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Java Eclipse Web Service Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Java\/Eclipse\/WebService\/Primer\/Java_Eclipse_WebService_Primer-30of.jpg\" title=\"Java Eclipse Web Service Primer Tutorial\" \/><\/a><p class=\"wp-caption-text\">Java Eclipse Web Service Primer Tutorial<\/p><\/div>\n<p>Here we see the &#8220;Hello World&#8221; of PHP Web Service Primer Tutorials and will leave a lot of the explanation to the <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Java\/Eclipse\/WebService\/Primer\/\" title='Java Eclipse Web Service Primer Tutorial'>Java Eclipse Web Service Primer Tutorial<\/a> that did a lot of work in making the Hello.wsdl this tutorial works off, which is explained further down.<\/p>\n<p>This tutorial uses the <a target=_blank title='MAMP framework on Mac laptop for Apache\/PHP\/MySql' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=933'>MAMP<\/a> framework&#8217;s Apache (local) Web Server on a Mac laptop as its network protocol and so http:\/\/localhost:8888\/Server.php?startclient=y does the whole &#8220;shebang&#8221; (in programming to say Hello World).<\/p>\n<p>Download and rename to <a target=_blank title='wsdl file' href='http:\/\/www.rjmprogramming.com.au\/PHP\/WebService\/Hello.wsdl_GETME'>Hello.wsdl<\/a> as you see fit.<\/p>\n<p>Download and rename to <a target=_blank title='wsdl file' href='http:\/\/www.rjmprogramming.com.au\/PHP\/WebService\/Server.php_GETME'>Server.php<\/a> as you see fit.<\/p>\n<p>Download and rename to <a target=_blank title='wsdl file' href='http:\/\/www.rjmprogramming.com.au\/PHP\/WebService\/Client.php_GETME'>Client.php<\/a> as you see fit.<\/p>\n<p>Thanks to Joel Hainley for this very good <a target=_blank title='Good PHP Web Service tutorial' href='http:\/\/www.joelhainley.com\/index.php\/2008\/03\/03\/php-soap-a-simple-php-web-service-example\/'>tutorial<\/a> which helped a lot.<\/p>\n<hr \/>\n<p><strong><em>Previous relevant Java Eclipse Web Service Primer Tutorial text is shown below (and tutorialized in the second picture above) &#8230; its resultant Hello.wsdl does a lot of the legwork for the PHP WebService above:<\/em><\/strong><\/p>\n<p>Web Services allows for communication using the World Wide Web between two devices, as <a target=_blank title='Web service on Wikipedia' href='http:\/\/en.wikipedia.org\/wiki\/Web_service'>Wikipedia<\/a> explains below.   This tutorial is using Eclipse IDE which works on Mac OS X and Windows, but if you are interested, look at <a target=_blank title='ASP.Net Web Service' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=1795'>ASP.Net Web Service Primer Tutorial<\/a> for a Windows only idea.<\/p>\n<p><\/p>\n<blockquote><p>A web service is a method of communication between two electronic devices over the World Wide Web. A web service is a software function provided at a network address over the web or the cloud, it is a service that is &#8220;always on&#8221; as in the concept of utility computing.<\/p>\n<p>The W3C defines a &#8220;Web service&#8221; as:<\/p>\n<p>    [&#8230;] a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the Web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards.[1]<\/p>\n<p>The W3C also states:<\/p>\n<p>    We can identify two major classes of Web services:<\/p>\n<p>        REST-compliant Web services, in which the primary purpose of the service is to manipulate XML representations of Web resources using a uniform set of &#8220;stateless&#8221; operations; and<br \/>\n        arbitrary Web services, in which the service may expose an arbitrary set of operations.[2]<\/p>\n<\/blockquote>\n<p>In this tutorial I wanted to show you the basics and closely followed the Eclipse IDE Java advice of this <a target=_blank title='Simple Web Service on Java Eclipse IDE' href='http:\/\/www.eclipse.org\/webtools\/community\/education\/web\/t320\/Implementing_a_Simple_Web_Service.pdf'>PDF<\/a> document by T320 E-business technologies, for whose expertise I am very grateful (thank you, thank you, thank you, thank you).<\/p>\n<p>Eclipse IDE is a great IDE for developing Android Apps via Java as we discussed in <a target=_blank title='Android App on Windows' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=561'>Android Application (on Windows) Primer Tutorial<\/a>, and this time around we are going to use the Mac OS X Eclipse (because we don&#8217;t want to hide our eclipse behind a bushel!?).   Will show you some information from <a target=_blank title='Eclipse IDE information from Wikipedia' href='http:\/\/en.wikipedia.org\/wiki\/Eclipse_%28software%29'>Wikipedia<\/a> about Eclipse below.<\/p>\n<blockquote><p>In computer programming, Eclipse is a multi-language Integrated development environment (IDE) comprising a base workspace and an extensible plug-in system for customizing the environment. It is written mostly in Java. It can be used to develop applications in Java and, by means of various plug-ins, other programming languages including Ada, C, C++, COBOL, Fortran, Haskell, JavaScript, Perl, PHP, Python, R, Ruby (including Ruby on Rails framework), Scala, Clojure, Groovy, Scheme, and Erlang. It can also be used to develop packages for the software Mathematica. Development environments include the Eclipse Java development tools (JDT) for Java and Scala, Eclipse CDT for C\/C++ and Eclipse PDT for PHP, among others.<\/p>\n<p>The initial codebase originated from IBM VisualAge.[2] The Eclipse software development kit (SDK), which includes the Java development tools, is meant for Java developers. Users can extend its abilities by installing plug-ins written for the Eclipse Platform, such as development toolkits for other programming languages, and can write and contribute their own plug-in modules.<\/p>\n<p>Released under the terms of the Eclipse Public License, Eclipse SDK is free and open source software (although it is incompatible with the GNU General Public License[3]). It was one of the first IDEs to run under GNU Classpath and it runs without problems under IcedTea.<br \/>\nContents<\/p><\/blockquote>\n<p>This tutorial is a primer tutorial like the &#8220;Hello World&#8221; tutorial of Web Services accessing a local Apache Tomcat web server on a Mac OS X laptop, but it can easily be used as a starting point for your further investigation, as this is a large LARGE subject area.<\/p>\n<p><strong>Below are some good background reading for the concepts of this tutorial all via Wikipedia:<\/strong><\/p>\n<ul>\n<li><a target=_blank title='Java' href='http:\/\/en.wikipedia.org\/wiki\/Java_(programming_language)'>Java<\/a><\/li>\n<li><a target=_blank title='XML' href='http:\/\/en.wikipedia.org\/wiki\/XML'>XML<\/a><\/li>\n<li><a target=_blank title='SOAP' href='http:\/\/en.wikipedia.org\/wiki\/SOAP'>SOAP<\/a><\/li>\n<li><a target=_blank title='TCP\/IP' href='http:\/\/en.wikipedia.org\/wiki\/Internet_protocol_suite'>TCP\/IP<\/a><\/li>\n<li><a target=_blank title='Web Services Descriptive Language' href='http:\/\/en.wikipedia.org\/wiki\/Web_Services_Description_Language'>Web Services Descriptive Language<\/a><\/li>\n<li><a target=_blank title='Apache Tomcat web server' href='http:\/\/en.wikipedia.org\/wiki\/Apache_Tomcat'>Apache Tomcat Web Server<\/a>&nbsp;<a target=_blank title='Downloads and Information via The Apache Software Foundation \"spiritual home\"' href='http:\/\/tomcat.apache.org\/'>(downloads and information via &#8220;spiritual home&#8221;)<\/a><\/li>\n<li><a target=_blank title='IDE' href='http:\/\/en.wikipedia.org\/wiki\/Integrated_development_environment'>Integrated Development Environment<\/a><\/li>\n<li><a target=_blank title='NetBeans' href='http:\/\/en.wikipedia.org\/wiki\/NetBeans'>NetBeans<\/a><\/li>\n<li><a target=_blank title='Client-server model' href='https:\/\/en.wikipedia.org\/wiki\/Client%E2%80%93server_model'>Client-server model<\/a><\/li>\n<\/ul>\n<p>Maybe you&#8217;ll want to read about <a target=_blank title='RESTful Web API' href='http:\/\/en.wikipedia.org\/wiki\/Representational_state_transfer#RESTful_web_APIs'>RESTful Web API<\/a> as well.<\/p>\n<p>Download and rename to <a target=_blank title='wsdl file' href='http:\/\/www.rjmprogramming.com.au\/Java\/Eclipse\/WebService\/Primer\/Hello.wsdl_GETME'>Hello.wsdl<\/a> as you see fit. This file is 90%+ used as the basis for <a target=_blank title='PHP Web Service Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=1884'>PHP Web Service Primer Tutorial<\/a>.<\/p>\n<p>Some personal experience with Web Services and SAP B1 Web Services (ASP.Net) is shown <a target=_blank title='SAP B1 Web Services personal experience' href='http:\/\/www.rjmprogramming.com.au\/SAPB1\/Web\/'>here<\/a>.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d1884' onclick='var dv=document.getElementById(\"d1884\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?s=PHP\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d1884' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Here we see the &#8220;Hello World&#8221; of PHP Web Service Primer Tutorials and will leave a lot of the explanation to the Java Eclipse Web Service Primer Tutorial that did a lot of work in making the Hello.wsdl this tutorial &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-web-service-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,25,37],"tags":[558,932,997,1319,1412],"class_list":["post-1884","post","type-post","status-publish","format-standard","hentry","category-elearning","category-networking","category-tutorials","tag-hello-world","tag-php","tag-programming","tag-tutorial","tag-web-service"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/1884"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=1884"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/1884\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=1884"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=1884"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=1884"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}