PHP5: how do I reuse SoapClient (session persistence)
Posted: Mon Mar 26, 2007 4:51 pm
Hi
I'm writing a php5 app that uses the buil-in SoapClient class to consume a .NET soap service. The soap service has session support. Here's a sample response
My app works fine except that I have to create a new SoapClient every time. The user requests something from my server, I create a soapclient, connect to the soap service, authenticate, make request, send reply back to user. User requests something else from my server, I create a soapclient, connect, etc ... and do the whole thing again.
I know how to use php's session handling to track my user. And the soap service is tracking ME with ITS session. What I need is to be able to reuse the soapclient or at least be able to tell the new soapclient to reuse the same session. I thought of saving the client in $_SESSION, but of course that doesn't work because there are two resource variables (sdl and httpurl). I can save soapclient['_cookies'] but I don't know how to use it and whether that'll actually work.
help? thanks in advance.
I'm writing a php5 app that uses the buil-in SoapClient class to consume a .NET soap service. The soap service has session support. Here's a sample response
Code: Select all
POST /xxxxxxx/xxxxxx.asmx HTTP/1.1
Host: xxx.xxx.xxx.xxx:xxxx
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.1.6
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://......"
Content-Length: 238
Cookie: ASP.NET_SessionId=4l45ah4xxxxxxxxxxxxxxxx;I know how to use php's session handling to track my user. And the soap service is tracking ME with ITS session. What I need is to be able to reuse the soapclient or at least be able to tell the new soapclient to reuse the same session. I thought of saving the client in $_SESSION, but of course that doesn't work because there are two resource variables (sdl and httpurl). I can save soapclient['_cookies'] but I don't know how to use it and whether that'll actually work.
help? thanks in advance.