I m trying to create a helloworld
Web service using that class, i have created WSDL file ...
But Unable to call it from client End
HelloWorldClass.php
<?php
class HelloWorldClass
{
public function printHello()
{
return 'Hello User';
}
public function add($p1, $p2) {
return ($p1+$p2);
}
}
?>
index.php to create WSDL using wsdlCreater Class
<?php
require_once('WSDLCreator.php');
$WSDLCreator = new WSDLCreator("myTestWsdl", "http://192.168.1.49/php2wsdl");
$WSDLCreator -> addFile("HelloWorldClass.php");
$WSDLCreator -> addURLToClass('HelloWorldClass',"http://192.168.1.49/php2wsdl/HelloWorldClass.php");
$WSDLCreator -> addURLToTypens("XMLCreator", "http://192.168.1.49/php2wsdl");
$WSDLCreator -> createWSDL();
$WSDLCreator -> printWSDL(true);
?>
SoapClient.PHP
= new";
echo $client ->__soapCall('printHello',array());
}
catch (Exception $e)
{
echo $e->getMessage()."<br><pre>";
}
?>
GENERATED WSDL FILE:--
<definitions name="myTestWsdl" targetNamespace="urn:myTestWsdl">
−
<message name="add">
<part name="p1" type="xsd:float"/>
<part name="p2" type="xsd:float"/>
</message>
−
<message name="addResponse">
<part name="addReturn" type="xsd:float"/>
</message>
<message name="printHello"/>
−
<message name="printHelloResponse">
<part name="printHelloReturn" type="xsd:string"/>
</message>
−
<portType name="HelloWorldClassPortType">
−
<operation name="add">
<documentation>Adds two numbers</documentation>
<input message="typens:add"/>
<output message="typens:addResponse"/>
</operation>
−
<operation name="printHello">
<documentation>Get the example</documentation>
<input message="typens:printHello"/>
<output message="typens:printHelloResponse"/>
</operation>
</portType>
−
<binding name="HelloWorldClassBinding" type="typens:HelloWorldClassPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
−
<operation name="add">
<soap:operation soapAction="urn:HelloWorldClassAction"/>
−
<input>
<soap:body namespace="urn:myTestWsdl" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
−
<output>
<soap:body namespace="urn:myTestWsdl" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
−
<operation name="printHello">
<soap:operation soapAction="urn:HelloWorldClassAction"/>
−
<input>
<soap:body namespace="urn:myTestWsdl" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
−
<output>
<soap:body namespace="urn:myTestWsdl" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
−
<service name="myTestWsdlService">
−
<port name="HelloWorldClassPort" binding="typens:HelloWorldClassBinding">
<soap:address location="http://192.168.1.49/php2wsdl/HelloWorldClass.php"/>
</port>
</service>
</definitions>