[PHP] How to call webservice without WSDL

So simple, see below.

server.php

<?php
class TestWebService
{
    function hello($you_name = 'ycTIN')
    {
        return "hi, i am $you_name";
    }
}
 
$server = new SoapServer(null, array ('uri'=>''));
$server->setClass('TestWebService');
$server->handle();
?>
client.php

<?php
$options = array (
	'location'=>'http://www.yctin.com/webservice/TestWebService/server.php',
	'uri'=>''
);
 
$client = new SoapClient(null, $options);
echo $client->hello('ycTIN');
?>

Related posts:

  1. Popular HTTP response status code in the web development The popular HTTP response code with simple description: 2xx Success...
  2. [PHP] Detect and handle execution timeout error Sometime php will throw unhandled exception, e.g. over maximum execution...


1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
Tags: , , ,  

Leave a Reply