I am trying to access the methods of a class that are present on a different server on my current server , so that i can share their methods , so that dont have to write the same methods again
So i configured and installed the PHP SOAP extension on my system..
After that i created a SOAPService.php file on my server side which has the following code.
<?php
// *** The SOAP class wrapper: myClassSoapServer.php ***
require_once('bc_seller_classes/Vendor/Vendor.php');
$options = array('uri' => 'http://merchants.bookchor.local/bc_seller_classes/Vendor/');
$SOAPServer = new SoapServer(null, $options);
$SOAPServer->setClass('Vendor');
$SOAPServer->handle();
?>
Here as you can see i wanted to access the Vendor class .
And on the client side i made soap.php with the following code , so that i could access the get_module() method of the Vendor class.
<html>
<head></head>
<body>
<?php
// *** The SOAP way: using a class remotely ***
$options = array(
'location' => 'http://merchants.bookchor.local/VendorSoapService.php',
'uri' => 'http://merchants.bookchor.local/'
);
$hdl = new SoapClient(null, $options);
var_dump($hdl);
$data = $hdl->get_module();
echo "hi";
var_dump($data);
?>
</body>
</html>
But when i execute soap.php on the client side it gives the following error
Uncaught SoapFault exception: [Client] looks like we got no XML document
So where am i going wrong .
PS: the get_module() function returns an array which i would like to use here. and Both the SOAPService.php and soap.php are placed in the root folder of the project .
Aucun commentaire:
Enregistrer un commentaire