Soapclient wsdl使用自定义http请求标头进行初始化

I have wsld url. I have to add custom http request header to authorize for this wsdl. When I try soapclient as following , I get error.

/* userName and password is masked in this question */
$opts = array(
        'http'=>array(
                "userName:xxxxx
".
                "password:xxxxxx
"
        )

);
$streamContext  = stream_context_create($opts);
$cilent = new SoapClient("https://iflyrestest.ibsgen.com:6013/iRes_Booking_WS/services/AvailabilityPort?wsdl" , array('stream_context'    => $streamContext));

Error:

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't find <definitions> in

Because response is like 'You are not authorized to access this URL...'

Also When I try function 'file_get_content()' with same stream_context, I successfully get content of this url.

How should I use soapclient for this case ?

if you're sure it is a basic authentication, then you can simply use the login and password SoapClient options, instead of stream_context, with your credentials, it should work then.