note 83026 added to function.soap-soapheader-construct
| From: | aeolianmeson at dontfindme dot blitzeclipse dot com | Date: | Wed, 07 May 2008 15:31:32 +0000 |
| Subject: | note 83026 added to function.soap-soapheader-construct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139129@lists.php.net to get a copy of this message | ||
To do headers (the raw way):
// Setting "trace" will allow us to view the request that we are making, after we have
made it.
$objClient = new SoapClient("http://www.somewhere.com/wsdls/some.wsdl",
array('trace' => true));
// These parameters satisfy this specific remote call.
$arrParameters_Login = array('username' => 'username', 'password'
=> 'password', 'company' => 'Company');
// Invoke the remote call "login()".
$objLogin = $objClient->login($arrParameters_Login);
// Grab session ID that this remote call will provide.
$strSessionID = $objLogin->loginReturn->sessionId;
// Set headers-- The remote call "query()" will require a header pointing to our session.
$strHeaderComponent_Session =
"<SessionHeader><sessionId>$strSessionID</sessionId></SessionHeader>";
$objVar_Session_Inside = new SoapVar($strHeaderComponent_Session, XSD_ANYXML, null, null, null);
$objHeader_Session_Outside = new SoapHeader('namespace.com', 'SessionHeader',
$objVar_Session_Inside);
// More than one header can be provided in this array.
$objClient->__setSoapHeaders(array($objHeader_Session_Outside));
// Set the query parameters.
$strQuery = 'select empID from Time where empID = 92389278';
$arrParameters_Query = array('queryString' => $strQuery);
// Make call.
$objResponse = $objClient->query($arrParameters_Query);
header('Content-Type: text/xml; ');
print($objClient->__getLastRequest());
The request that goes out:
<SOAP-ENV:Envelope>
<SOAP-ENV:Header>
<SessionHeader>
<sessionId>8789364113604871127</sessionId>
</SessionHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:query>
<ns1:queryString>select empID from Time where empID = 92389278</ns1:queryString>
</ns1:query>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
----
Server IP: 209.41.74.194
Probable Submitter: 216.45.240.70
----
Manual Page -- http://www.php.net/manual/en/function.soap-soapheader-construct.php
Edit -- https://master.php.net/note/edit/83026
Del: integrated -- https://master.php.net/note/delete/83026/integrated
Del: useless -- https://master.php.net/note/delete/83026/useless
Del: bad code -- https://master.php.net/note/delete/83026/bad+code
Del: spam -- https://master.php.net/note/delete/83026/spam
Del: non-english -- https://master.php.net/note/delete/83026/non-english
Del: in docs -- https://master.php.net/note/delete/83026/in+docs
Del: other reasons-- https://master.php.net/note/delete/83026
Reject -- https://master.php.net/note/reject/83026
Search -- https://master.php.net/manage/user-notes.php