Created
June 24, 2016 08:58
-
-
Save stormwild/a48b6de1a9c35eec320340c0f1edf101 to your computer and use it in GitHub Desktop.
PHP: minimal example of SOAP Server and Client
This file contains hidden or 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