First you need to create a classSoapClient , just like you:
$url = "http://www.w3schools.com/webservices/tempconvert.asmx?WSDL";
$client = new SoapClient($url);
Then you must call the method you want to use . Method names can be found in WSDL.
, CelsiusToFahrenheit WebService:
$result = $client->CelsiusToFahrenheit( );
, , ; ...
WSDL, :
<s:element name="CelsiusToFahrenheit">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Celsius" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
, , 1 , "Celsius" , .
, PHP:
$result = $client->CelsiusToFahrenheit(array('Celsius' => '10'));
:
var_dump($result);
:
object(stdClass)#2 (1) {
["CelsiusToFahrenheitResult"]=>
string(2) "50"
}
, :
echo $result->CelsiusToFahrenheitResult . "\n";
:
50
: WSDL - . CelsiusToFahrenheitResponse.