The SoapHeader class

(PHP 5 >= 5.0.1)


Represents a SOAP header.

Class synopsis

SoapHeader {
/* Methods */
__construct ( string $namespace , string $name [, mixed $data [, bool $mustunderstand [, string $actor ]]] )
SoapHeader ( string $namespace , string $name [, mixed $data [, bool $mustunderstand = false [, string $actor ]]] )

Table of Contents

add a note add a note

User Contributed Notes 1 note

john at jtresponse dot co dot uk
5 years ago
None of the examples really do it for me.
Note: you should NOT need to hard-code any XML.

Here is an example of creating a nested header and including a parameter.

$client = new SoapClient(WSDL,array());

$auth = array(
        'SystemId'=> array('_'=>'DATA','Param'=>'PARAM'),
  $header = new SoapHeader('NAMESPACE','Auth',$auth,false);

Gives the following header XML:

      <ns1:SystemId Param="PARAM">DATA</ns1:SystemId>
To Top