Hi,
I am newbie and recently I started working on PHP.
Problem description:
I have one class called Employee and it has one property called
Salary. I am developing a web service using nuSOAP libarary which will
expose a method to get employee details, i.e. GetEmployeeDetails. This
web method should return object of Employee type.
Now my first query is that how to return customized type using nuSOAP
library?
my code for consuming web service is like this,
<?php
require_once ('lib/nusoap.php');
require ('Employee.php');
$client = new nusoap_client('
http://localhost:5050/Projects/
empPayroll/WebService.php');
$emp = new Employee();
$param = array('name' => 'employee name');
$emp = $client->call('GetEmployeeDetails', $param);
echo $message->Salary();
?>
When I execute above file in browser it returns following error:
Fatal error: Call to a member function Salary() on a non-object in D:
\Program Files\wamp\www\Projects\empPayroll\index.php on line 17
My assumption is that when I say
$emp = $client->call('GetEmployeeDetails', $param);
it actually creates a new "emp" variable instead of retaining it as
Employee type of object.
AND THIS IS GETTING NIGHTMARE FOR ME :(
Let me know if anyone of you have any solution for above problem.
Regards,
Dave Naimish