Re: [PHP-SOAP-DEV] bug storing the SoapObject in session
Status: Alpha
Brought to you by:
rodif_bl
|
From: brad l. <rod...@ya...> - 2002-05-15 14:00:19
|
Well ill try and make the SoapObject "sessionable" next release. It would be
eaiser if __wakeup and __sleep got called to the SoapObject.
- Brad
--- andrey <ahr...@ic...> wrote:
> I want persistent client object because I want to access a soap service and
> to have a live session on the remote part between requests of client part.
> So I do a site which uses SOAP remote service for authentication and SOAP
> remote service for accounting the time a employee has spent in the office.
> There are 2 classes -> CAuthenticate & CPresence in 2 files. When users logs
> in into the system by using CAuthenticate a session is created and some
> stuff about the user is stored there(caching). When an user wants to state
> that it is in working time method CPresence::presence_login($comment) is
> called, and all info about the user is gotten from the session but I can
> keep the session_id only(as far as I know) with keeping SoapObject in client
> part. There is a little hack(because of lack of private vars) - on the
> client part I modificate $client->location & $client->uri to get it work
> with another service. I've no such warning message on my box but this is
> because the error_reporting level is set to something strange.
>
> Hope that clears what I do.
>
> Andrey
> ----- Original Message -----
> From: "brad lafountain" <rod...@ya...>
> To: "andrey" <ahr...@ic...>
> Cc: <php...@li...>
> Sent: Monday, May 13, 2002 8:22 PM
> Subject: Re: [PHP-SOAP-DEV] bug storing the SoapObject in session
>
>
> > Yeah this basically is the problem...
> >
> >
> > But the bigger problem is that __wakeup and __sleep don't get passed to
> > overloaded 'c' objects (which is what SoapObject is). I posted a patch a
> while
> > ago along with the ability to serailzie java objects. It never got
> patched.
> >
> >
> > But besides that the example up on the website was ment to show you the
> > perstance server objects not a perstant client objects.
> >
> >
> > Hope this helps
> >
> > - Brad
> >
> > --- andrey <ahr...@ic...> wrote:
> > > I think I know what is the problem.
> > > When object is serialiazed all it's properties are serialized but some
> > > properties have no meaning after serialization. For example a class
> wrapper
> > > for DB connection may have property $link (resource of type mysql) but
> this
> > > link has meaning only on the page where it is created. If we serialize
> $link
> > > there will be problem when deserialized. I don't know what is the
> solution
> > > for module but in userspace this is solvable with 2 methods
> > > __sleep(), __wakeup(). In case you don't know about them I'll explain.
> When
> > > PHP wants to serialize an object it tries to execute __sleep() if mehtod
> > > with such name executes. PHP wants to receive an array with names
> (strings)
> > > of properties that have to be serialized. Probably if there is no
> __sleep()
> > > all properties are serialized. On the other hand when PHP deserializes
> an
> > > object it tries to call __wakeup(). __wakeup() is used in case some
> > > initializations are needed on object recreation - in our case (PHP-SOAP)
> > > httpurl is of type resource and has to be created in __wakeup() and not
> to
> > > be serialized - so __sleep() has to return an array with names where
> there
> > > is no element "httpurl".
> > >
> > > Regards,
> > > Andrey
> > >
> > > ----- Original Message -----
> > > From: "phpsurf" <ph...@if...>
> > > To: "brad lafountain" <rod...@ya...>;
> > > <php...@li...>
> > > Sent: Friday, May 10, 2002 1:12 PM
> > > Subject: [PHP-SOAP-DEV] bug storing the SoapObject in session
> > >
> > >
> > > > Hi
> > > >
> > > > I tried something with your 4th example : session
> > > >
> > > > your example shows haow to maintain a session on the server side
> through
> > > > serveral consecutive calls to method of the SoapObject on the client
> side,
> > > > but inside the same script.
> > > >
> > > > my idea was to maintain this soap-server session through several calls
> to
> > > > the soap-client script.
> > > >
> > > > so I simply tried to put the SoapObject (client side) in session.
> > > >
> > > > here is my new session-client-src.php script:
> > > >
> > > > ----------------------------------------------------
> > > > <?
> > > > session_start();
> > > > session_register("session");
> > > >
> > > > if(!isset($session)) {
> > > > echo "create Soap Client\n";
> > > > $session = new
> > > >
> > >
> SoapObject("http://lab.localhost.com/soap/PhpSoapToolkit/samples/session-ser
> > > > ver-src.php", "urn:Session");
> > > > }
> > > >
> > > > echo "counter:\n";
> > > >
> > > > echo $session->inc() . "\n";
> > > > echo $session->inc() . "\n";
> > > > ?>
> > > > ----------------------------------------------------
> > > >
> > > > The 1st time I call this script, I get the following result :
> > > >
> > > > ----------------------------------------------------
> > > > create Soap Client
> > > > counter:
> > > > 0
> > > > 1
> > > > ----------------------------------------------------
> > > >
> > > >
> > > > But the 2nd time I call this script, I get the following result which
> is
> > > > fine (the counter is well incremented), except for the warning :)
> > > >
> > > > ----------------------------------------------------
> > > > counter:
> > > > <br />
> > > > <b>Warning</b>: (null)(): supplied argument is not a valid httpurl
> > > resource
> > > > in
> > > <b>c:\webroot\lab\soap\phpsoaptoolkit\samples\session-client-src.php</b>
> > > > on line <b>12</b><br />
> > > > 2
> > > > 3
> > > > ----------------------------------------------------
> > > >
> > > > hope you will find out the bug !
> > > >
> > > >
> > > >
> > > >
> > >
> ____________________________________________________________________________
> > > __
> > > > ifrance.com, l'email gratuit le plus complet de l'Internet !
> > > > vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
> > > > http://www.ifrance.com/_reloc/email.emailif
> > > >
> > > >
> > > >
> > > > _______________________________________________________________
> > > >
> > > > Have big pipes? SourceForge.net is looking for download mirrors. We
> supply
> > > > the hardware. You get the recognition. Email Us:
> ban...@so...
> > > > _______________________________________________
> > > > Phpsoaptoolkit-development mailing list
> > > > Php...@li...
> > > >
> https://lists.sourceforge.net/lists/listinfo/phpsoaptoolkit-development
> > > >
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > LAUNCH - Your Yahoo! Music Experience
> > http://launch.yahoo.com
> >
> > _______________________________________________________________
> >
> > Have big pipes? SourceForge.net is looking for download mirrors. We supply
> > the hardware. You get the recognition. Email Us: ban...@so...
> > _______________________________________________
> > Phpsoaptoolkit-development mailing list
> > Php...@li...
> > https://lists.sourceforge.net/lists/listinfo/phpsoaptoolkit-development
> >
>
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
|