473,725 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PEAR::SOAP Class variable access problema

Hi all,
I've a problem with PHP5 + PEAR::SOAP.
I Have the following 2 script that implements a simple web service:

The Server Code running on WinXP + PHP5 + Apache 2.x:
----------------------------------------------------

<?php
require_once('S OAP/Server.php');
require_once('S OAP/Disco.php');
class pearsoaptest
{
var $__dispatch_map = array();
var $txt = "I am a test\n";
function __construct()
{
$this->__dispatch_m ap['AddString'] = array('in' => array('s_in' => 'string'), 'out' => array('s_out' =>
'string'), );
$this->__dispatch_m ap['GetString'] = array('in' => array(), 'out' => array('s_out' => 'string'), );
$this->txt .= "Contructor execution END\n";
}
function AddString($s_in )
{
$this->txt .= $s_in . "\n";
return $this->txt;
}
function GetString()
{
return $this->txt;
}
}

$server = new SOAP_Server();
$webservice = new pearsoaptest();
$server->addObjectMap($ webservice,'htt p://schemas.xmlsoap .org/soap/envelope/');
if (isset($_SERVER['REQUEST_METHOD ']) && $_SERVER['REQUEST_METHOD ']=='POST') {
$server->service($HTTP_ RAW_POST_DATA);
} else {
$disco = new SOAP_DISCO_Serv er($server,'pea rsoaptest');
header("Content-type: text/xml");
if (isset($_SERVER['QUERY_STRING']) && (strcasecmp($_S ERVER['QUERY_STRING'],'wsdl') == 0) ) {
echo $disco->getWSDL();
} else {
header("Content-type: text/xml");
echo $disco->getDISCO();
}
}
exit;
?>

and the client script running on WinXP + PHP5
---------------------------------------------

#!/usr/local/bin/php
<?php
require_once 'SOAP/Client.php';

try {
$_web_service_u rl = 'http://localhost/pearsoaptestser ver.php?wsdl';
$wsdl = new SOAP_WSDL($_web _service_url);
$pearsoaptest = $wsdl->getProxy();
$params = array("s_in"=>" Adding a Line 2");
$option = array();
echo "\n-- Call the web service GET methods:\n";
$ret = $pearsoaptest->GetString();
if (PEAR::isError( $ret))
{
print("Error: " . $ret->getMessage() . "\n");
} else {
print ($ret);
};
echo "\n-- First Call the web service ADD methods:\n";
$ret = $pearsoaptest->AddString("Add ing a Line 1");
if (PEAR::isError( $ret))
{
print("Error: " . $ret->getMessage() . "\n");
} else {
print ($ret);
};
echo "\n-- Call the web service ADD methods:\n";
$ret = $pearsoaptest->call("AddStrin g",$params,$opt ion);
if (PEAR::isError( $ret))
{
print("Error: " . $ret->getMessage() . "\n");
} else {
print ($ret);
};
echo "\n-- Call the web service GET methods:\n";
$ret = $pearsoaptest->GetString();
if (PEAR::isError( $ret))
{
print("Error: " . $ret->getMessage() . "\n");
} else {
print ($ret);
};
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage() , "\n";
}
echo "\n\n";
?>

This is the client execution output:
------------------------------------

D:\Web-Service>php pearsoaptestcli ent.php

-- Call the web service GET methods:
I am a test
Contructor execution END

-- First Call the web service ADD methods:
I am a test
Contructor execution END
Adding a Line 1

-- Call the web service ADD methods:
I am a test
Contructor execution END
Adding a Line 2

-- Call the web service GET methods:
I am a test
Contructor execution END

---------------------------------------------
As you can see the output is not the expected one:

I am a test
Contructor execution END
Adding a Line 1
Adding a Line 2
So I've the idea that the SOAP invocation of a remote class does not permit the access to the class variable to the
methods but only to the class constructor (and only the first time it was invoked).
Can someone confirm me this thesis or if is not so can someone say me where I have made errors?

Bye and thank you
Samuel Zallocco (L'Aquila - ITALY)
Feb 3 '06 #1
0 1912

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

Similar topics

0
4406
by: Arne Kösling | last post by:
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).
0
1913
by: Jimmy Jim | last post by:
OK, I am so frustrated with PEAR SOAP, I have it working, but it seems when I include a file and in that file is a function with global variables, those globals are not set. Anyone have ANY knowledge of this?? Here is an example: file: server.php ...... function test() { include_once(age.php);
0
2384
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. :'-(
0
823
by: Doug Farrell | last post by:
Hi all, I'm trying to make use of PEAR::SOAP am and having problems. I've tried a number examples I've found on the web, but to no avail. I've set things up so I have to separate servers on my machine, the server at port 1100 and the client at port 1101. However, no luck getting anything to talk. Whenever the client goes into the 'call' function of the SOAP/Client.php class, it never returns. So, basically I'm asking if anyone could...
0
4093
by: Henrik Brautaset Aronsen | last post by:
I am having problems converting from Pear SOAP to PHP5 SOAP, especially when it comes to complex types. I would be grateful for any help on how this should be translated: require_once("SOAP/Client.php"); $wsdlurl = "http://myserver/myservices/mypage.php?wsdl"; $wsdl = new SOAP_WSDL($wsdlurl, array("timeout" => 360));
3
7244
by: junkmail | last post by:
on a win 2k server apparantly it is saying i dont have it. or it cant find it. im using mySQL 4.1 php 4.3.x apache 3.0.53 im new to php and am doing some tutorials, but when i run the sripts it tells mea it can not run pear/soap, because it can not be found.the book im learning form does not tell me how to install or configure this extension. so now im looking for help.
0
1464
by: Alexander Waldmann | last post by:
Hi, i have PEAR::SOAP installed correctly (beta, all dependent packages are installed). When i try out the following simple Script <?php print "Include is ... "; include_once("SOAP/Server.php"); print " ok!"; ?>
0
1352
by: wagemage.pt | last post by:
I'm having some trouble with PEAR soap and a response from a webservice when the number of results is one or more than one. Versions are PHP 4.4.2-1build1, PEAR-1.4.6, SOAP-0.9.4 running in Linux (Ubuntu Dapper) When we have multiple items in the result, all goes well, and I can use the result straight away (I do some JSON translation afterwards, but that's beyond the scope of my question).
0
5607
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/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
0
8872
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8747
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9392
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9091
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8069
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6694
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3211
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2150
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.