php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #32410 Documentation unclear for SoapHeader
Submitted: 2005-03-22 16:52 UTC Modified: 2009-11-23 14:35 UTC
Votes:8
Avg. Score:4.9 ± 0.3
Reproduced:8 of 8 (100.0%)
Same Version:6 (75.0%)
Same OS:4 (50.0%)
From: gehrig at ishd dot de Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
 [2005-03-22 16:52 UTC] gehrig at ishd dot de
Description:
------------
The manual states:
"SoapHeader is a special low-level class for passing or returning SOAP headers. It's just a data holder and it does not have any special methods except its constructor. It can be used in the SoapClient->__soapCall() method to pass a SOAP header or in a SOAP header handler to return the header in a SOAP response."

But there is no information on what a "SOAP header handler" is and how to implement one.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-04-03 00:50 UTC] david at mytton dot net
What part of the manual are you referencing and what kind of extra information are you looking for?
 [2005-04-03 11:59 UTC] gehrig at ishd dot de
On http://www.php3.de/soap there is a section headed "SoapHeader". In this section the manual states: 
"SoapHeader is a special low-level class for passing or returning SOAP headers. It's just a data holder and it does not have any special methods except its constructor. It can be used in the SoapClient->__soapCall() method to pass a SOAP header or in a SOAP header handler to return the header in a SOAP response."

But it doesn't mention how to implement a, what it calls, "SOAP header handler". I'd like to receive a header in a SOAP request to a PhP5-SOAP-server (which is no problem at all) and I'd like to send back a header in the SOAP response from this server - but I have no clue how to do this.
 [2005-07-09 20:25 UTC] jplush76 at gmail dot com
I agree it would be nice to have more information here. Soap headers are a big part of web services and the manual treats them as a glace over
 [2005-12-23 08:07 UTC] cat_lan at 163 dot com
Sorry, my english is poor, see code below:
-------------------------
function foo()
{
return new soapHeader(...);
}

soapServer::addFunction("foo");
--------------------------

---about the function name "foo":
.wsdl----------------------->|
<header message="..." part="foo" use="literal" />
post data------------------->|
<soap:Header><foo>........</foo></soap:Header>
 [2007-02-26 09:38 UTC] philip@php.net
David Mytton is documenting ref.SOAP, assigning this to him.
 [2007-03-01 14:08 UTC] michiel at worthit dot nl
When using SoapServer I too was in need for returning SoapHeaders. Confused by the documentation I started browsing the CVS and ended at http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/server023.phpt?view=markup&sortby=date, where the function 'addSoapHeader' is tested.

Basically, you can define your headers like you should in your wsdl and then do something like this.

---

function foo() {
    $server = $GLOBALS['server'];
    $server->addSoapHeader(new SoapHeader('my.wsdl', 'bar', true));

// optionally return data
}

$server = $GLOBALS['server'] = new SoapServer('my.wsdl'[, ...]);

$server->addFunction('foo');

$server->handle();

---

I hope someone found this comment to be useful ;).
 [2008-01-08 15:42 UTC] bisho at onirica dot com
I also miss information about this in the doc:

If the header part "Example" has use="literal" the function with the same name ("Example") will be executed on the SoapServer.

But:
a) With use="encoded" nothing gets executed. This drove me crazy and should be mentioned on documentation.
b) The function "Example" does not receive arguments. So, how you are supposed to process the header? I'm still trying to solve this.
 [2009-09-10 12:47 UTC] sjoerd@php.net
The paragraph mentioned in the original bug report is already removed.

Suggestions to improve the documentation on SoapHeader:
1. Add a link to SoapServer::addSoapHeader to the "See also" section of SoapHeader::SoapHeader.
2. In the documentation of SoapServer::addSoapHeader, describe that the object is of type SoapHeader.
3. In the documentation of SoapClient::__setSoapHeaders, describe that soapheaders is either a SoapHeader or an array of SoapHeaders, or make a reference to the SoapHeader documentation.

The previous comment from bisho at onirica notes some valid points about the calling of functions to handle Soap headers by the SoapServer. This is poorly documented and doesn't work reliably. However, I suggest creating a seperate bug report for that.
 [2009-09-11 13:13 UTC] sjoerd@php.net
Created bug #49530.
 [2009-11-23 14:35 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2009-11-23 14:35 UTC] svn@php.net
Automatic comment from SVN on behalf of vrana
Revision: http://svn.php.net/viewvc/?view=revision&revision=291207
Log: Describe SoapHeader (bug #32410)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 00:01:34 2025 UTC