1

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

I'm set headers:

$logIn = new LogIn();
$logIn->setEmail('email@email.com');
$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@email.com</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@email.com</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?

Roman
  • 39
  • 4
  • 1
    Have you tried to use `SoapVar`, like shown here: https://stackoverflow.com/questions/13465168/php-namespaces-in-soapheader-child-nodes ? – Bogdan Mar 17 '21 at 11:00
  • No, I have not found this way. I think this will work for me. But it will be very uncomfortable, since I will have to rewrite a 7 classes from stdClass to SoapVar. But thanks anyway. This is useful information. – Roman Mar 17 '21 at 11:22

0 Answers0