Longhorn PHP 2025 - Speakers and Schedule Announced!

Voting

: five plus three?
(Example: nine)

The Note You're Voting On

DesmondJ
20 years ago
Following OrionI's example:

<?php
$client
= new SoapClient("http://server/sumservice.asmx?WSDL");
$params->a = 2;
$params->b = 3;
$objectresult = $client->Sum($params);
$simpleresult = $objectresult->SumResult;
print(
$simpleresult); //produces "-1"
?>

Please note that the lines:

"$client->Sum($params);"

and

"$simpleresult = $objectresult->SumResult;"

are based off of each other. If your web service function is called "Sum", then add "Result" to the end of it to get the results of the call.

EG:

<?php
$client
= new SoapClient("http://server/mathservice.asmx?WSDL");
$params->a = 2;
$params->b = 3;
$objectresult = $client->Minus($params); // note the name of the function is "Minus"
$simpleresult = $objectresult->MinusResult; // note the name of the result is referenced as "MinusResult"
print($simpleresult); //produces "5"
?>

<< Back to user notes page

To Top