Roman
Roman

Reputation: 39

PHP. Set namespace to all elements SOAP headers

I think my question is fairly simple but can't really find the answer.

I'm set headers:

$logIn = new LogIn();
$logIn->setEmail('[email protected]');
$logIn->setPassword('123456');
$header = new \SoapHeader('NAMESPACE', "logIn", $logIn, false);
$client->__setSoapHeaders($header);

And I get a header in the xlm file:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="NAMESPACE">
    <SOAP-ENV:Header>
    <ns1:logIn>
        <email>[email protected]</email>
        <password>123456</password>
    </ns1:logIn>
...

But to successfully validate on the server, I need to get a header like this:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="NAMESPACE">
    <SOAP-ENV:Header>
    <ns1:logIn>
        <ns1:email>[email protected]</ns1:email>
        <ns1:password>123456</ns1:password>
    </ns1:logIn>
...

The documentation does not specify a parameter that determines where the namespace will or will not be added. Maybe someone knows how to solve my problem?

Upvotes: 1

Views: 91

Answers (0)

Related Questions