[phpsoa] problem with require_once and global

2007-03-13 Thread mbertazz

Hi everybody,
to be clear i will explain my problem using the code below.

My problem is: when i use "m1" i obtain this error:

[Wed Mar 14 01:20:37 2007] [error] PHP Notice:  Fatal: CFG is not
configured! Exiting. in /home/messe318/setup.php on line 93
/home/messe318/setup.php(93) : Notice - Fatal: CFG is not configured!
Exiting.

why "global $CFG" doesn't wok into setup.php using SCA (if i call
setup.php directly it work) ?

the problem is i can't change config.php and setup.php, i can chage
pluto.php and pippo.php.

thank you in advance.
mbertazz


pluto->m2($a,$b);
}
}
?>




k= '123';
$CFG->z= '456';

require_once("setup.php");
?>


k)) {
trigger_error('Fatal: CFG is not configured! Exiting.');
die;
}

function m3()
...
?>


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"phpsoa" group.
To post to this group, send email to phpsoa@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.co.uk/group/phpsoa?hl=en
-~--~~~~--~~--~--~---



[phpsoa] Re: problem with require_once and global

2007-03-14 Thread mbertazz

hi Matthew,
thank you very much for your help.

> I haven't checked what will happen when we use the pippo.php as the
> target of a webservice call, when it will be being called at the top
> level again. I will try that tomorrow.

yes, this is the real problem i found: i'm calling it as the target of
a webservice call.

thank you again,
mbertazz

On Mar 14, 6:24 pm, "Matthew Peters" <[EMAIL PROTECTED]>
wrote:
> Hi mbertazz,
> This is a tricky little problem. The essence of the problem is that
> config.php only expects to find itself called from the very top level
> script, where all variables are global. That is why it does not bother
> to do global $CFG itself. However, when we call pippo.php for the
> first time e.g. from a client script like:
>/* client.php */
>   include_once('SCA/SCA.php');
>   $s = SCA::getService('pippo.php');
>   echo $s->m1('a','b');
> ?>
>
> then the require_once(config.php) is being called from a script that
> is already several calls down from in the call stack.
>
> The following fix works for calling the component locally:
>/* client.php */
>   require_once('config.php');
>   include_once('SCA/SCA.php');
>   $s = SCA::getService('pippo.php');
>   echo $s->m1('a','b');
> ?>
>
> whihc gets the call to config.php done nice and early.
>
> I haven't checked what will happen when we use the pippo.php as the
> target of a webservice call, when it will be being called at the top
> level again. I will try that tomorrow.
>
> Hope that helps,
> Matthew
>
> On Mar 14, 12:27 am, "mbertazz" <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi everybody,
> > to be clear i will explain my problem using the code below.
>
> > My problem is: when i use "m1" i obtain this error:
>
> > [Wed Mar 14 01:20:37 2007] [error] PHP Notice:  Fatal: CFG is not
> > configured! Exiting. in /home/messe318/setup.php on line 93
> > /home/messe318/setup.php(93) : Notice - Fatal: CFG is not configured!
> > Exiting.
>
> > why "global $CFG" doesn't wok into setup.php using SCA (if i call
> > setup.php directly it work) ?
>
> > the problem is i can't change config.php and setup.php, i can chage
> > pluto.php and pippo.php.
>
> > thank you in advance.
> > mbertazz
>
> >  > /* pippo.php */
>
> > include "SCA/SCA.php";
>
> > /**
> >  *
> >  * @service
> >  * @binding.ws
> >  *
> >  */
> > class pippo
> > {
>
> > /**
> >  *
> >  * @reference
> >  * @binding.php Pluto.php
> >  */
> >  public $pluto;
>
> > /**
> >  *
> >  * @param string $a
> >  * @param string $b
> >  * @return string
> >  */
> > function m1($a,$b){
> > return $this->pluto->m2($a,$b);
> > }}
>
> > ?>
>
> >  > /* Pluto.php */
>
> > require_once('config.php');
>
> > class Pluto
> > {
> > function m2($a, $b){
> > global $CFG;
> > m3();
> > return $a.$b;
> > }}
>
> > ?>
>
> >  > /* config.php */
>
> > unset($CFG);
>
> > $CFG->k= '123';
> > $CFG->z= '456';
>
> > require_once("setup.php");
> > ?>
>
> >  > /* setup.php */
>
> > global $CFG;
>
> > if (!isset($CFG->k)) {
> > trigger_error('Fatal: CFG is not configured! Exiting.');
> > die;
> > }
>
> > function m3()
> > ...
> > ?>- Hide quoted text -
>
> - Show quoted text -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"phpsoa" group.
To post to this group, send email to phpsoa@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.co.uk/group/phpsoa?hl=en
-~--~~~~--~~--~--~---



[phpsoa] Re: problem with require_once and global

2007-03-20 Thread mbertazz

Thank you very much Matthew! It's ok.

Good night,
Matteo

On Mar 15, 12:37 pm, "Matthew Peters"
<[EMAIL PROTECTED]> wrote:
> Hi mbertazz,
>
> Well, it was solved pretty simply by putting
> require_once('config.php') at the top of pippo.php, before the include
> for SCA.php.
>
> When pippo.php gets called as the target of a web service request, the
> lines of code at the top of pippo.php are running at the very top
> level, so config.php gets to run in the environment it expects, where
> variables are global.
>
> So just make the top of pippo.php look like this:
>
>  /* pippo.php */
>
> require_once('config.php');
>
> include "SCA/SCA.php";
>
> .../...
> ?>
>
> Let me know how you get on.
>
> Matthew
>
> On Mar 14, 5:52 pm, "mbertazz" <[EMAIL PROTECTED]> wrote:
>
>
>
> > hi Matthew,
> > thank you very much for your help.
>
> > > I haven't checked what will happen when we use the pippo.php as the
> > > target of a webservice call, when it will be being called at the top
> > > level again. I will try that tomorrow.
>
> > yes, this is the real problem i found: i'm calling it as the target of
> > a webservice call.
>
> > thank you again,
> > mbertazz
>
> > On Mar 14, 6:24 pm, "Matthew Peters" <[EMAIL PROTECTED]>
> > wrote:> Hi mbertazz,
> > > This is a tricky little problem. The essence of the problem is that
> > > config.php only expects to find itself called from the very top level
> > > script, where all variables are global. That is why it does not bother
> > > to do global $CFG itself. However, when we call pippo.php for the
> > > first time e.g. from a client script like:
> > >  > >   /* client.php */
> > >   include_once('SCA/SCA.php');
> > >   $s = SCA::getService('pippo.php');
> > >   echo $s->m1('a','b');
> > > ?>
>
> > > then the require_once(config.php) is being called from a script that
> > > is already several calls down from in the call stack.
>
> > > The following fix works for calling the component locally:
> > >  > >   /* client.php */
> > >   require_once('config.php');
> > >   include_once('SCA/SCA.php');
> > >   $s = SCA::getService('pippo.php');
> > >   echo $s->m1('a','b');
> > > ?>
>
> > > whihc gets the call to config.php done nice and early.
>
> > > I haven't checked what will happen when we use the pippo.php as the
> > > target of a webservice call, when it will be being called at the top
> > > level again. I will try that tomorrow.
>
> > > Hope that helps,
> > > Matthew
>
> > > On Mar 14, 12:27 am, "mbertazz" <[EMAIL PROTECTED]> wrote:
>
> > > > Hi everybody,
> > > > to be clear i will explain my problem using the code below.
>
> > > > My problem is: when i use "m1" i obtain this error:
>
> > > > [Wed Mar 14 01:20:37 2007] [error] PHP Notice:  Fatal: CFG is not
> > > > configured! Exiting. in /home/messe318/setup.php on line 93
> > > > /home/messe318/setup.php(93) : Notice - Fatal: CFG is not configured!
> > > > Exiting.
>
> > > > why "global $CFG" doesn't wok into setup.php using SCA (if i call
> > > > setup.php directly it work) ?
>
> > > > the problem is i can't change config.php and setup.php, i can chage
> > > > pluto.php and pippo.php.
>
> > > > thank you in advance.
> > > > mbertazz
>
> > > >  > > > /* pippo.php */
>
> > > > include "SCA/SCA.php";
>
> > > > /**
> > > >  *
> > > >  * @service
> > > >  * @binding.ws
> > > >  *
> > > >  */
> > > > class pippo
> > > > {
>
> > > > /**
> > > >  *
> > > >  * @reference
> > > >  * @binding.php Pluto.php
> > > >  */
> > > >  public $pluto;
>
> > > > /**
> > > >  *
> > > >  * @param string $a
> > > >  * @param string $b
> > > >  * @return string
> > > >  */
> > > > function m1($a,$b){
> > > > return $this->pluto->m2($a,$b);
> > > > }}
>
> > > > ?>
>
> > > >  > > > /* Pluto.php */
>
> > > > require_once('config.php');
>
> > > > class Pluto
> > > > {
> > > > function m2($a, $b){
> > > > global $CFG;
> > > > m3();
> > > > return $a.$b;
> > > > }}
>
> > > > ?>
>
> > > >  > > > /* config.php */
>
> > > > unset($CFG);
>
> > > > $CFG->k= '123';
> > > > $CFG->z= '456';
>
> > > > require_once("setup.php");
> > > > ?>
>
> > > >  > > > /* setup.php */
>
> > > > global $CFG;
>
> > > > if (!isset($CFG->k)) {
> > > > trigger_error('Fatal: CFG is not configured! Exiting.');
> > > > die;
> > > > }
>
> > > > function m3()
> > > > ...
> > > > ?>- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"phpsoa" group.
To post to this group, send email to phpsoa@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.co.uk/group/phpsoa?hl=en
-~--~~~~--~~--~--~---



[phpsoa] passing parameters by reference

2007-09-18 Thread mbertazz

Hi all,
i've a question about passing parameters by reference and not by
value.
I'm using WS binding to talk with a remote service. I can't change or
ask to change that remote service and it use a "by reference"
approach.
Is there some way to use SCA impl. in this particular case?
I think it's not a useful way to force access to private attribute of
returned object...

I read this sentence in SCA documentation:

"How parameters are always passed by value (and not by reference)
between components, even when the calls are local. This ensures that
the semantics of a call do not change depending on the location of a
component."

I can agree, but can you explain me deeply WHY "passing by reference"
is not supported so i can be more "strong" defending it?

Thank you in advence
M


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"phpsoa" group.
To post to this group, send email to phpsoa@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.co.uk/group/phpsoa?hl=en
-~--~~~~--~~--~--~---



[phpsoa] Re: passing parameters by reference

2007-09-21 Thread mbertazz

Dear Graham,
thank yuo for your answer.
I'm attaching the wsdl file.

As you can see there are "in/out" paramenters.
When i make a call i can't access the result because it's private.

Thank you in advance,
Matteo



http://YYY.YYY.YYY.YYY:/X_WS/X_WSAImpl";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:tnsa="http://YYY.YYY.YYY.YYY:/X_WS/X_WSA";>
http://YYY.YYY.YYY.YYY:/X_WS/
X_WSA"
 location="http://YYY.YYY.YYY.YYY:/X_WS/
X_WSA.wsdl"/>

http://schemas.xmlsoap.org/soap/http";
style="rpc"/>


http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>


http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>





http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>


http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>





http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>


http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>





http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>


http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>





http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>


http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>





http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>


http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>





http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>


http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>





http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>


http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>





http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>


http://schemas.xmlsoap.org/
soap/encoding/" use="encoded"/>






http://YYY.YYY.YYY.YYY:/
WEBSERVICES/SOAP"/>









On 19 Set, 11:20, Graham Charters <[EMAIL PROTECTED]> wrote:
> Hi M,
>
> Passing by-value is what the SCA specifications 
> (seehttp://osoa.org/display/Main/Service+Component+Architecture+Specifica...)
> say should be the calling semantics for remote services.  SCA in PHP
> treats all services as remote and assumes local by-reference calls
> will just be done using the normal features of PHP.
>
> Passing by-value is a good practice for remote service calls because
> it helps with decoupling the two environments by not relying on
> sharing instance data.
>
> I'm afraid I don't fully understand the scenario you're describing.
> Would it be possible for you to post an example WSDL and a description
> of what you think needs to be supported?
>
> Regards, Graham.
>
> On 18 Sep, 16:59, mbertazz <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
> > i've a question about passing parameters by reference and not by
> > value.
> > I'm using WS binding to talk with a remote service. I can't change or
> > ask to change that remote service and it use a "by reference"
> > approach.
> > Is there some way to use SCA impl. in this particular case?
> > I think it's not a useful way to force access to private attribute of
> > returned object...
>
> > I read this sentence in SCA documentation:
>
> > "How parameters are always passed by value (and not by reference)
> > between components, even when the calls are local. This ensures that
> > the semantics of a call do not change depending on the location of a
> > component."
>
> > I can agree, but can you explain me deeply WHY "passing by reference"
> > is not supported so i can be more "strong" defending it?
>
> > Thank you in advence
> > M


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"phpsoa" group.
To post to this group, send email to phpsoa@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.co.uk/group/phpsoa?hl=en
-~--~~~~--~~--~--~---