note 63190 added to function.soap-soapheader-construct
| From: | harlanatplauditdesigndotcom at osu1 dot php dot net | Date: | Wed, 15 Mar 2006 19:04:42 +0000 |
| Subject: | note 63190 added to function.soap-soapheader-construct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-105867@lists.php.net to get a copy of this message | ||
Here is a way to get headers on the server side. It will fill up an assoc with all headers in a
namespace. In its current state, it only handles text content; but each header is expanded to a
DOMNode, so you can do whatever you wish to parse custom types.
In my case this method is useful because I want to pass PHPSESSID in a SOAP header, and I need to
set it before I even call SoapServer::handle().
//
// READ SOAP HEADERS, STOP READING AT SOAPENV:BODY ELEMENT
//
$xml = new XmlReader();
$xml->XML( $HTTP_RAW_POST_DATA );
$shoppingCartHeaders = array();
while( $xml->read() ) {
if( $xml->namespaceURI == "urn:com.plauditdesign.shoppingcart.client.headers#"
&& $xml->nodeType == XMLReader::ELEMENT ) {
$headerNode = $xml->expand();
$shoppingCartHeaders[ $xml->localName ] = $headerNode->textContent;
} elseif( $xml->namespaceURI == "http://schemas.xmlsoap.org/soap/envelope/"
&& $xml->nodeType == XMLReader::ELEMENT
&& $xml->localName == "Body" ) {
$xml->close();
}
}
...
if( isset( $shoppingCartHeaders["sessionId"] ) ) {
session_id( $shoppingCartHeaders["sessionId"] );
}
...
$server->setPersistence( SOAP_PERSISTENCE_SESSION );
$server->handle();
----
Server IP: 216.194.113.175
Probable Submitter: 63.87.118.237
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.soap-soapheader-construct.php
Edit -- http://master.php.net/note/edit/63190
Del: integrated -- http://master.php.net/note/delete/63190/integrated
Del: useless -- http://master.php.net/note/delete/63190/useless
Del: bad code -- http://master.php.net/note/delete/63190/bad+code
Del: spam -- http://master.php.net/note/delete/63190/spam
Del: non-english -- http://master.php.net/note/delete/63190/non-english
Del: in docs -- http://master.php.net/note/delete/63190/in+docs
Del: other reasons-- http://master.php.net/note/delete/63190
Reject -- http://master.php.net/note/reject/63190
Search -- http://master.php.net/manage/user-notes.php