Skip to content

Instantly share code, notes, and snippets.

@stormwild
Created June 24, 2016 08:58
Show Gist options
  • Select an option

  • Save stormwild/a48b6de1a9c35eec320340c0f1edf101 to your computer and use it in GitHub Desktop.

Select an option

Save stormwild/a48b6de1a9c35eec320340c0f1edf101 to your computer and use it in GitHub Desktop.
PHP: minimal example of SOAP Server and Client
<?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