Hi Khurrum,
I am sorry but this really isn't going to work the way you want it to.
You are right that the first call to the service is setting the
instance variables in the class, and that when you come back on the
second call they are not set. That is because your second call comes
back to a completely separate instamce of the class. It's not to do
with SCA at all - it's the way that the PHP engine throws away
everything between calls and keeps nothing from one call to the next.
The calls are stateless, and this is the usual style for a web
service.

If you want to keep values from one call to another they have to be
kept somewhere other than in PHP variables. The most common place to
keep them would be in a database, or a flat file. The first call would
have to return a key for where the values were kept, and the second
call would have to pass that key back in again.

What might be confusing is that here is a case where we get different
behaviour sepending on whether the call is local or remote. If you
make this a local call (i.e. do a getService for CommonServices.php so
that you get local calls, on the same call stack) the PHP engine does
not throw away the class between calls and the instance variables are
kept between calls. Sorry if that has confused you.

Matthew

On Feb 11, 12:41 pm, khurrum <[EMAIL PROTECTED]> wrote:
> Guys,
> if anyone call help me here...i am using this sample service and it
> works fine for me but if you see i am using intUserID and intParentID
> as class variables.
>
> now when i called the init method they are set what ever i send them
> through the params.but when i try to call the getUser function on the
> client it gives me null values ,what i think here that SCA is not
> supporting the class variable at all ,so if a new function is called
> after init ,i cant get the updated public class variables values?
>
> this is serious and need help...look at the below code..
>
> /**
>  * @service
>  * @binding.soap
>  */
> class CommonServices
> {
>     /**
>     * @var int
>     */
>         public $intUserID;
>         /**
>     * @var int
>     */
>         public $intParentID;
>
>         /**
>      * @param int $pUserID
>      * @param int $pParentID
>      * @return boolean "
>     */
>         public function init($pUserID,$pParentID)
>         {
>                 //Setting Class based variables
>                 $this->intUserID=$pUserID;
>                 $this->intParentID=$pParentID;
>
>                 return false;
>         }
>         /**
>      * @param string $pOption
>      * @return string "
>      */
>         public function getUser($pOption){
>                         return $this->intUserID.",".$this->intParentID;
>         }
>
> }
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to