PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
returns Object on running Pear:Soap client

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Web Services
View previous topic :: View next topic  
Author Message
purshotaml



Joined: 24 Oct 2006
Posts: 2
Location: india

PostPosted: Wed Oct 25, 2006 9:23 am    Post subject: returns Object on running Pear:Soap client Reply with quote

Here is my major-problem located, My Helly World example produces no errors, But instead of returning "Hello World" as answer, it only returns "Object", It makes no diffence, what I want to submit, there s only the answer "Object" and this makes me sick and sleepless, because I run out of time (i have to do this for an university-exam)


Here is my Example Code :

(Client)

<?

require_once('SOAP/Client.php');

/* Create a new SOAP client using PEAR::SOAP's SOAP_Client-class: */
$client = new SOAP_Client('http://localhost/pearsoap-hello-server.php');


/* Define the parameters we want to send to the server's helloWorld-function.
Note that these arguments should be sent as an array: */
$params = array('inmessage'=>'World');

/* Send a request to the server, and store its response in $response: */
$response = $client->call('helloWorld',$params,array('namespace' =>
'urn:helloworld'));

/* Print the server-response: */
print $response;

?>

(Server)

<?

/* Include PEAR::SOAP's SOAP_Server class: */
require_once('SOAP/Server.php');


/* To define a new SOAP service with PEAR::SOAP, we need to
construct a class that defines the characteristics for our
service. An instance of this class is then used by SOAP_Server
to create a new SOAP service: */
class SOAP_Hello_Server
{

/* $dispatch_map helps SOAP_Server figure out which parameters
are used with the methods: */
var $dispatch_map = array();

/* dispatch mapping is optional. It is used in non-wsdl servers to allow
for being more explicit with what arguments and types are passed in and
out.*/
/* Here's the constructor for out class. It is used to define
$dispath_map: */
function SOAP_Hello_Server()
{
$this->dispatch_map['helloWorld'] = array('in' =>
array('inmessage'=>'string'),
'out' =>
array('outmessage'=>'string'));
}

/* Of course, we also need to define all the functions that should
be requestable through our server: */
function helloWorld($inmessage)
{
/* Generate a SOAP error if the argument was not valid: */
if($inmessage == '')
{
/* The SOAP error is generated by the SOAP_Fault class: */
$fault = new SOAP_Fault('You must supply a valid
string!','12345');
return $fault->message();
}
else
{
/* If the argument is okay, we submit out return message: */
return "Hello $inmessage!";
}
}
}

/* Create a new SOAP server using PEAR::SOAP's SOAP_Server class: */
$server = new SOAP_Server();

/* Create an instance of our class: */
$soaphelloserver = new SOAP_Hello_Server();

/* Register this instance to the server class: */
$server->addObjectMap($soaphelloserver,array('namespace'=>
'urn:helloworld'));

/* The following line starts the actual service: */
$server->service($HTTP_RAW_POST_DATA);


?>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Web Services All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement