<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7861556102842996397</id><updated>2012-02-17T07:45:04.863+05:30</updated><category term='SOAP'/><category term='PHP'/><category term='WSDL'/><category term='XML RPC'/><category term='UDDI'/><category term='Nusoap'/><category term='Web Service'/><title type='text'>Vinsomania</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://vinsomania.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7861556102842996397/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://vinsomania.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>vinu</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7861556102842996397.post-4485884618605658173</id><published>2009-06-22T14:53:00.035+05:30</published><updated>2009-12-10T17:15:44.884+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='SOAP'/><category scheme='http://www.blogger.com/atom/ns#' term='Web Service'/><category scheme='http://www.blogger.com/atom/ns#' term='XML RPC'/><category scheme='http://www.blogger.com/atom/ns#' term='Nusoap'/><category scheme='http://www.blogger.com/atom/ns#' term='WSDL'/><category scheme='http://www.blogger.com/atom/ns#' term='UDDI'/><title type='text'>PHP Web Services with NuSOAP</title><content type='html'>&lt;h4&gt;&lt;strong&gt;Introduction &lt;br /&gt;&lt;/strong&gt;&lt;/h4&gt;NuSOAP is a group of PHP classes that allow developers to create and consume SOAP web services.  It does not require any special PHP extensions.This document describes how to obtain and install NuSOAP, then provides some samples to illustrate the capabilities of NuSOAP.  It is by no means an exhaustive description of NuSOAP, but it is hopefully enough to get any PHP coder started. Programming with NuSOAP follows this up with more complex samples.&lt;br /&gt;&lt;h4&gt;What are Web Services&lt;/h4&gt;The term Web services describes a standardized way of integrating Web-based applications using the XML, SOAP, WSDL and UDDI open standards over an Internet protocol backbone. XML is used to tag the data, SOAP is used to transfer the data, WSDL is used for describing the services available and UDDI is used for listing what services are available. Used primarily as a means for businesses to communicate with each other and with clients, Web services allow organizations to communicate data without intimate knowledge of each other's IT systems behind the firewall.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_46c0B8EUDRA/Sj9PAbz6aLI/AAAAAAAAAGQ/OWvHbtS5eIY/s1600-h/ajax_webservice-300x146.gif"&gt;&lt;img style="cursor: pointer; width: 300px; height: 146px;" src="http://1.bp.blogspot.com/_46c0B8EUDRA/Sj9PAbz6aLI/AAAAAAAAAGQ/OWvHbtS5eIY/s320/ajax_webservice-300x146.gif" alt="" id="BLOGGER_PHOTO_ID_5350081751223527602" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;h4&gt;Web Services Protocol Stack&lt;/h4&gt;The Web Services protocol stack consists of three key XML-based technologies: SOAP (Simple Object Access Protocol), WSDL (Web Service Description Language), and UDDI (Universal Description, Discovery and Integration).&lt;br /&gt;&lt;strong&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;UDDI&lt;/span&gt;:&lt;/strong&gt; This layer is responsible for centralizing services into a common registry, and providing easy publish/find functionality. Currently, service discovery is handled via the UDDI. The UDDI specification can help to solve making it possible to discover the right services from the millions currently online. Learn more about UDDI here.&lt;br /&gt;&lt;strong&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;WSDL&lt;/span&gt;:&lt;/strong&gt; This layer is responsible for describing the public interface to a specific Web service, which is an XML-based language that describes the various functions that a Web service is capable of. Currently, service description is handled via the WSDL. You do not need to learn all the nitty-gritty details because there are tools that generate WSDL for you. You can get one here.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;strong&gt;SOAP:&lt;/strong&gt;&lt;/span&gt; This layer is responsible for encoding messages in a common XML format so that messages can be understood at either end. Currently, this includes XML-RPC and SOAP. For example, the client program bundles up two values  to be added into a SOAP message, which is sent to the Web service by sending it as the body of an HTTP POST request. The server unpacks the SOAP request that the application can understand and executes Add operation. Next, the server packages up that result of summation as response into another SOAP message, which it sends back to the client program in response to its HTTP request. The client program unpacks the SOAP message to obtain the results of the summation. So, &lt;strong&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;SOAP&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(153, 51, 0);"&gt; XML&lt;/span&gt;&lt;/strong&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;+&lt;/span&gt;&lt;strong&gt;&lt;span style="color: rgb(0, 0, 255);"&gt; HTTP&lt;/span&gt;&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_46c0B8EUDRA/Sj9X3e9piWI/AAAAAAAAAGY/UVJ_c_95Iiw/s1600-h/sidefig2-150x150.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 295px; height: 263px;" src="http://4.bp.blogspot.com/_46c0B8EUDRA/Sj9X3e9piWI/AAAAAAAAAGY/UVJ_c_95Iiw/s320/sidefig2-150x150.gif" alt="" id="BLOGGER_PHOTO_ID_5350091493055498594" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/h4&gt;&lt;br /&gt;&lt;h4&gt;Creating Nusoap&lt;br /&gt;&lt;/h4&gt;Download latest version of nusoap.php from &lt;a title="http://sourceforge.net/projects/nusoap/" href="http://sourceforge.net/projects/nusoap/" target="_blank"&gt;http://sourceforge.net/projects/nusoap/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here I am going to create a server which will take &lt;span style="color: rgb(255, 0, 0);"&gt;UserID &lt;/span&gt;as request and fetch User's details with respect to the &lt;span style="color: rgb(255, 0, 0);"&gt;UserID&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Creating the user's table&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;blockquote style="color: rgb(102, 51, 255);"&gt;CREATE TABLE `tbl_user` (&lt;br /&gt;`user_id` int(11) NOT NULL auto_increment,&lt;br /&gt;`user_name` varchar(30) NOT NULL default '',&lt;br /&gt;`password` varchar(70) NOT NULL default '',&lt;br /&gt;`first_name` varchar(100) NOT NULL default '',&lt;br /&gt;`last_name` varchar(100) NOT NULL default '',&lt;br /&gt;`email_id` varchar(100) NOT NULL default '',&lt;br /&gt;PRIMARY KEY  (`user_id`)&lt;br /&gt;) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;&lt;/blockquote&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;Creating a &lt;span style="color: rgb(204, 0, 0);"&gt;php &lt;/span&gt;page to fetch record from table &lt;span style="color: rgb(0, 102, 0);"&gt;"tbl_user"&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;blockquote&gt;&lt;span style="color: rgb(255, 0, 0); font-weight: bold;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;# Save this code a userclass.php&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;br /&gt;class Users {&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;function DBConnection()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;mysql_pconnect ('HostName', 'UserName', 'PassWord') ;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;mysql_select_db ('DataBaseName');&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;function getUserDetails($userid){&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$this-&gt;DBConnection();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$Query = "SELECT * FROM tbl_user&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(102, 51, 255);"&gt; where user_id = $userid";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$result = mysql_query($Query) or die(" Your ERROR CODE ");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;if(!$result) {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;die(" Your ERROr CODE ");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$cnt = 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$UserResultArray= array();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;while ($UserResult = mysql_fetch_assoc($result))&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;// Result Array&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$UserResultArray[$cnt] = array(&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;'UserID' =&gt; $UserResult["user_id"],&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;'UserName' =&gt; $UserResult["user_name"],&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;'FirstName' =&gt; $UserResult["first_name"],&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;'LastName' =&gt; $UserResult["last_name"],&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;'EmailID' =&gt; $UserResult["email_id"]);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$cnt = $cnt + 1;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;return $UserResultArray;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;// End of userclass.php&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(51, 51, 51);"&gt;Creating Nusoap Server code&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;blockquote&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;// Save this code as users.php&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;// Downloaded Nusoap file&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;require_once("nusoap.php");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;// Including the created php function file&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;require_once("userclass.php");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;// Name space name&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$ns="urn:UserDetails_wsdl";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$server = new soap_server();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;// Configure WSDL&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$server-&gt;configureWSDL('UserDetails_wsdl', 'urn:UserDetails_wsdl');&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$server-&gt;wsdl-&gt;schemaTargetNamespace=$ns;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;// Creating Complex type for out put (only for single record)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$server-&gt;wsdl-&gt;addComplexType('UserDetailsRow',&lt;br /&gt;'complexType','struct', 'all', '',&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;array( 'UserID' =&gt; array('name' =&gt; 'UserID', 'type' =&gt; 'xsd:int'),&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;'UserName' =&gt; array('name' =&gt; 'UserName','type' =&gt; 'xsd:string'),&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;'FirstName' =&gt; array('name' =&gt; 'FirstName','type' =&gt; 'xsd:string'),&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;'LastName' =&gt; array('name' =&gt; 'LastName','type' =&gt; 'xsd:string'),&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;'EmailID' =&gt; array('name' =&gt; 'EmailID','type' =&gt; 'xsd:string')&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;// Complex type for multiple record out put.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$server-&gt;wsdl-&gt;addComplexType('UserDetailsRows','complexType',&lt;br /&gt;'array','','SOAP-ENC:Array',&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;array(),array(array('ref'=&gt;'SOAP-ENC:arrayType','wsdl:arrayType'=&gt;'tns:UserDetailsRow[]')),&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;'tns:UserDetailsRow');&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;// Registering &lt;span style="font-weight: bold;"&gt;getUserDetails&lt;/span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;function for WSDL generation&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$server-&gt;register('&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;getUserDetails&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;',&lt;span style="color: rgb(255, 153, 0);"&gt; // method name&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;array('' =&gt; 'xsd:void'), &lt;span style="color: rgb(255, 153, 0);"&gt;// input parameters&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;array('return' =&gt; 'tns:UserDetailsRows'), &lt;span style="color: rgb(255, 153, 0);"&gt;// output parameters&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;'urn:UserDetails_wsdl', &lt;span style="color: rgb(255, 153, 0);"&gt;// namespace&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;'urn:UserDetails_wsdl#&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;getUserDetails&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;', &lt;span style="color: rgb(255, 153, 0);"&gt;// soapaction&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;'rpc', &lt;span style="color: rgb(255, 153, 0);"&gt;// style&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;'encoded', &lt;span style="color: rgb(255, 153, 0);"&gt;// use&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;'Fetching User details' &lt;span style="color: rgb(255, 153, 0);"&gt;// documentation&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;// Main function (Registered function)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;function getUserDetails($userid)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$userClass = new Users; // Object from userclass.php&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;return $&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;userClass&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;getUserDetails&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;($userid);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 102);"&gt;//=============&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 102);"&gt;// Output return&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 153, 102);"&gt;//=============&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$HTTP_RAW_POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$HTTP_RAW_POST_DATA = file_get_contents("php://input");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$server-&gt;service($HTTP_RAW_POST_DATA);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;exit();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(204, 102, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;// End of &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;&lt;span style="color: rgb(255, 153, 0);"&gt; users.php&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;You can access your WSDL file now using  http://localhost/users.php . You will be getting below out put&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_46c0B8EUDRA/SkB_g5jcz3I/AAAAAAAAAGg/2HF5EzIK5j8/s1600-h/wsdl.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 331px; height: 258px;" src="http://2.bp.blogspot.com/_46c0B8EUDRA/SkB_g5jcz3I/AAAAAAAAAGg/2HF5EzIK5j8/s400/wsdl.gif" alt="" id="BLOGGER_PHOTO_ID_5350416560498200434" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_46c0B8EUDRA/SkCABAn2_TI/AAAAAAAAAGo/r-IFDzzIug0/s1600-h/wsdld.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 339px;" src="http://1.bp.blogspot.com/_46c0B8EUDRA/SkCABAn2_TI/AAAAAAAAAGo/r-IFDzzIug0/s400/wsdld.gif" alt="" id="BLOGGER_PHOTO_ID_5350417112151555378" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Creating Client for Nusoap&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;// Save this code as getUserDetails.php&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;require_once('nusoap.php');&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$soapclient = new soapclient('http://localhost/users.php');&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$soapclient-&gt;debug_flag=true;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$err = $soapclient-&gt;getError(); &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$UserID = $_REQUEST["UserID"];&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$param = array("UserID"=&gt;$UserID);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;$result=$soapclient-&gt;call("getUserDetails",$param);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;header("Content-Type: text/xml\r\n");        &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;echo $soapclient-&gt;responseData;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 153, 0);"&gt; // End of getUserDetails.php&lt;/span&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;Now we can access our client using&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(102, 51, 255);"&gt;'http://localhost/getUserDetails.php?UserID=1'&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;Verify the below output of newly created Nusoap XML webservice . Make sure that you are passing UserID as argument in the query string .&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_46c0B8EUDRA/SkCB93VzstI/AAAAAAAAAGw/02QDNKT-G5I/s1600-h/result.gif"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 219px;" src="http://1.bp.blogspot.com/_46c0B8EUDRA/SkCB93VzstI/AAAAAAAAAGw/02QDNKT-G5I/s400/result.gif" alt="" id="BLOGGER_PHOTO_ID_5350419257143571154" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Now you can make your own webservices with different format .&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 102, 255);"&gt;Enjoy !!!!!!&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt; Vineesh.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 153, 0); font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7861556102842996397-4485884618605658173?l=vinsomania.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vinsomania.blogspot.com/feeds/4485884618605658173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vinsomania.blogspot.com/2009/06/php-web-services-with-nusoap.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7861556102842996397/posts/default/4485884618605658173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7861556102842996397/posts/default/4485884618605658173'/><link rel='alternate' type='text/html' href='http://vinsomania.blogspot.com/2009/06/php-web-services-with-nusoap.html' title='PHP Web Services with NuSOAP'/><author><name>vinu</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_46c0B8EUDRA/Sj9PAbz6aLI/AAAAAAAAAGQ/OWvHbtS5eIY/s72-c/ajax_webservice-300x146.gif' height='72' width='72'/><thr:total>5</thr:total></entry></feed>
