473,578 Members | 2,739 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PEAR::SOAP - Server returns only "Object" as answer

Hi !

I am new to Web Services. Therefore I ve set up a PHP Installation on Windows
(PHP 4.3.2 and Apache 1.3.29). I have tested PHP alone and then installed
PEAR. Now I am stuck there (Before that, I had many problems with the
PHP-dlls)

I've set up several SOAP Testscripts that I found on WebSites and in PHP-Books
to get a PHP Client and a PHP Server communicate over Web Services
(using PEAR::SOAP).

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)

I guess, there is something wrong with the installation, so PEAR might fail in
parsing the XML document, or so. If there any professionals out there who
ever worked with PEAR::SOAP and might know that problem, please help, i ll
need that. :(
Thanx in advance !

Regards,

Arne

-----

Example Code :

(Client)

<?

require_once('S OAP/Client.php');

/* Create a new SOAP client using PEAR::SOAP's SOAP_Client-class: */
$client = new SOAP_Client('ht tp://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('inmessag e'=>'World');

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

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

?>

(Server)

<?

/* Include PEAR::SOAP's SOAP_Server class: */
require_once('S OAP/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_Serv er
{

/* $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_Serv er()
{
$this->dispatch_map['helloWorld'] = array('in' =>
array('inmessag e'=>'string'),
'out' =>
array('outmessa ge'=>'string')) ;
}

/* Of course, we also need to define all the functions that should
be requestable through our server: */
function helloWorld($inm essage)
{
/* 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: */
$soaphelloserve r = new SOAP_Hello_Serv er();

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

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

Jul 17 '05 #1
0 4400

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

60
10038
by: English Teacher | last post by:
Which would be more useful to learn, PHP or COLDFUSION? I know Coldfusion is popular in the work force. Is PHP? Thanks!
0
2378
by: Arne Kösling | last post by:
Hi, PEAR:SOAP is not working. I've tried so many examples now and the only one that works, is that amazon example, which is too complex for me to understand. I am so reliant on the Web Services with SOAP .... and I can t get it work. :'-(
14
3184
by: lawrence | last post by:
To call I would do something like: $headline = McSelectJustOneField::callDatastore("cbHeadline"); Is this the correct use of the static keyword, to implement a Singleton design?
8
7917
by: Charon | last post by:
I see two colons in the middle of what look like method calls here and there. Such as when using PEAR // implement pear db object $this->_oConn =& DB::connect(DSN); I have looked all over the place and have been unable to figure out exactly what the :: means or does ? It does not appear to explain it in Programming PHP by O'Reilly, or I...
8
2329
by: Arvid Andersson | last post by:
Hello, I need to convert a string to a number, but the string can contain +,-,* and / as well as parenthesis. For example, if I have the string "30/(6+9)" I would like a function that returned the number 2. I actually wrote a java function that did this a couple of years ago, in school, as an excersise in "binary trees". I lost it, and most...
6
3666
by: Al Dykes | last post by:
I've just grabbed a PHP book and can deal with the syntax and now I need to decide to learn specific packages and features. Define "framework". What are the major framework flavors ? Under what conditions can I use two or more frameworks? Sorry for the beginners question.
0
5601
by: info | last post by:
Dear all, is the first time that I use SOAP, and i must say that i'm having several problems. this is SOAP message that expects the server =================XML EXPECTED FROM THE SERVER================ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"...
0
5546
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
9
2131
by: Ronald S. Cook | last post by:
Can I write If MyString = "Apple" Or MyString = "Orange" Or MyString = "Pear" Then to something more compact like If MyString In ("Apple", "Orange", "Pear") Then My last line obviously doesn't work but maybe I'm close?
0
7850
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7779
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8126
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8291
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6524
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5343
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1391
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1114
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.