WSDL web services example php.

In my previous article, i explain the thrmo of the web services using WSDL in php. Now, here i give the example of the WSDL web services, so you should be more clear on the php web services examples.

Below is the complete XML code for helloword wsdl web services in which we load text from the server. here user give there name as input (like php freelancer), while server give the output “hello, php freelancer”.

<?xml version="1.0"?>
<definitions name="helloworld" targetnamespace="urn:helloworld" xmlns:tns="urn:helloworld"  xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
  <types>
    <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetnamespace="urn:hello">
      <xsd:element name="getname" type="xsd:string" />
	  <xsd:element name="helloresponse" type="xsd:string" />	 	  
	</xsd:schema>			
  </types>
 
  <message name="dohello">
    <part name="yourname" type="tns:getname" />
  </message>
 
  <message name="dohelloresponse">
    <part name="return" type="tns:helloresponse" />
  </message>  
 
  <portType name="helloport">
    <operation name="dohello">
	  <input message="tns:dohello" />
	  <output message="tns:dohelloresponse" />
	</operation>
  </portType>
 
  <binding name="hellobinding" type="tns:helloport">
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
	  <operation name="dohello">
	    <soap:operation soapAction="urn:helloaction" />
		<input>
		  <soap:body use="encoded" namespace="urn:hello" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />		  
		</input>
		<output>
		  <soap:body use="encoded" namespace="urn:hello" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />		  
		</output>
	  </operation>
  </binding>
 
  <service name="helloService">
    <port name="helloport" binding="tns:hellobinding">
	  <soap:address location="http://localhost/test/wsdl/hello_server.php" />
	</port>
  </service>
 
</definitions>