I am using the SoapClient class in PHP to make a request. I am trying to create a nested header variable to pass in my request.
Currently my request headers looks like this,
<SOAP-ENV:Header>
<ns2:type>request</ns2:type>
...
</SOAP-ENV:Header>
I want it to look like this,
<SOAP-ENV:Header>
<ns2:ei>
<ns2:type>request</ns2:type>
...
</ns2:ei>
</SOAP-ENV:Header>
I am currently creating the headers like this,
$headers[] = new SoapHeader(
$nsp1,
"type",
"request"
);
$headers[] = new SoapHeader(...)
I have tried various ways to nest the headers the including,
$headers[] = new SoapHeader(
$nsp1,
"ei",
new SoapHeader(
$nsp1,
"type",
"request"
)
);
but this throws a fatal error.