'How to set headers to SOAP request in PHP SOAPClient before sending request?

I am creating a request in laravel for SOAP in which I have to set some headers too . What I am trying to do is given below

 $options = [
            'cache_wsdl' => 0,
            'trace' => 1,
            'stream_context' => stream_context_create([
                'ssl' => [
                    'verify_peer' => false,
                    'verify_peer_name' => false,
                    'allow_self_signed' => true,
                ]]),
        ];

      $soapClient = new SoapClient($config->url . '?WSDL', $options);
        $headers = new SoapHeader("http://tempuri.org/", "AuthorisationHeader", [
            'X-IBM-Client-Secret' => 'client-secret',
            'X-IBM-Client-ID' => 'client-header',
        ], false);
        $soapClient->__setSoapHeaders('namespace', 'ClientHeader', $headers);

        dd($soapClient);

but this throws a error

 SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://ibluatapig.indusind.com/app/uat/DomesticPayService1?WSDL' : failed to load external entity "https://ibluatapig.indusind.com/app/uat/DomesticPayService1?WSDL"

I am not able to find out why this is happening as I have also tried this same soap request in postman and it returned as expected

but in SoapClient what I am doing wrong any help please

THANK. YOU !!!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source