Created
September 18, 2018 12:14
-
-
Save kopitar/e97d35506febcc1ecae68d1adcd894d4 to your computer and use it in GitHub Desktop.
PHP: minimal example of SOAP Server and Client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// server | |
class MySoapServer | |
{ | |
public function getMessage() | |
{ | |
return 'Hello,World!'; | |
} | |
public function addNumbers($num1,$num2) | |
{ | |
return $num1+$num2; | |
} | |
} | |
$options= array('uri'=>'http://localhost/test'); | |
$server=new SoapServer(NULL,$options); | |
$server->setClass('MySoapServer'); | |
$server->handle(); | |
// client | |
$options= array( | |
'location' => 'http://localhost/debug.php', | |
'uri' => 'http://localhost/everth' | |
); | |
$client=new SoapClient(NULL,$options); | |
echo $client->getMessage(); //Hello,World! | |
echo $client->addNumbers(3,5); // 8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment