SOAP Persistence
| From: | Bill dot McCuistion at QBOpen dot com | Date: | Mon, 10 Oct 2005 15:36:49 +0000 |
| Subject: | SOAP Persistence | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-2026@lists.php.net to get a copy of this message | ||
Hello, list!
I have a PHP5 class that does many things with many properties.
Some fool with ASP.Net needs to use the class, so I wrapped the class into
a SOAP web service.
But, I have PHP 5.0.3 with SOAP enabled, so no biggie.
I have a WSDL built from the class.
<disco:discovery>
<scl:contractRef
ref="https://xproto.qbopen.com:443/QBMSGateway/PROG/LIBQBWS/QBOpenSoapServer.php?wsdl"/>
</disco:discovery>
I have a SOAP client and SOAP server, both in PHP5 using the WSDL.
So far, so good.
I want to have the session vars be persistent between soap client calls,
so following the guidance provided at:
http://www.php.net/manual/en/function.soap-soapserver-setpersistence.php,
I setPersistence as follows:
$server->setPersistence(SOAP_PERSISTENCE_SESSION);
Following are the SOAP Client request and response headers, which indicate
that the server is setting a response header with a cookie with PHPSESSID,
so I believe things are OK so far.
SOAP Client: __getLastRequestHeaders():
POST /QBMSGateway/PROG/LIBQBWS/QBOpenSoapServer.php HTTP/1.1
Host: xproto.qbopen.com
Connection: Keep-Alive
User-Agent: PHP SOAP 0.1
Content-Type: application/soap+xml; charset=utf-8;
action="urn:QBMSGateway#QBOpenQBMSGateway#ProcessCustomerCreditCardChargeRq"
Content-Length: 1564
SOAP Client: __getLastResponseHeaders():
HTTP/1.1 200 OK
Date: Mon, 10 Oct 2005 14:42:27 GMT
Server: Apache/2.0.52 (Win32) PHP/5.0.3 mod_ssl/2.0.52 OpenSSL/0.9.7e
X-Powered-By: PHP/5.0.3
Set-Cookie: PHPSESSID=p9r4melj4rp6rfuvrbrmjs8p77; expires=Mon, 10-Oct-2005
14:44:31 GMT; path=/; domain=QBOpen.com
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=ISO-8859-1
-------------
Now what?
I think I'm missing the "Theory of Operation" for soap persistence.
(1) The soap server does not (yet) use a $_SESSION var, but could.
(2) The soap client does not (yet) do a setCookie() call, but could.
When the class is used as a native PHP client class, the state of the
object's properties are retained between function calls, so I can do
interesting things. When the class is used with a SOAP Client, the state
is lost between function calls (SOAP Calls), so I can only do "somewhat"
interesting things. I think I'm very close to getting the SOAP usage on
par with the native PHP usage.
Thanks in advance (Dimity, George, et al).
Sincerely,
Bill.McCuistion@QBOpen.com
http://QBOpen.com ... Products, Services & Solutions for
Businesses large
& small
Tel: 281-842-1426 // Cell: 832-217-0771
~~~~~~~~~ (\_~~ (\_~~ (\_~~~~~~~~~~~~~ (\_~~ (\_~~ (\_~~~~~~~~