laravel-soap
laravel-soap copied to clipboard
HTTP Authorization header
Hi team,
Thank you for all the work that you guys have been put into this.
Have you got any guide where you guys show how to add a custom header to a request?
I have have tried different options but unfortunately nothing seems to work.
Basically I want to add
Authorization: Bearer
Would you guys please post an example on how to achieve this?
Here is my code: $nameespace = 'http://some-namespace'; $headerbody = array('Authorization' => "Bearer token"); $bearer_header = new SOAPHeader($nameespace, 'RequestorCredentials', $headerbody);
$soapWrapper = new SoapWrapper;
$soapWrapper->add('Inps', function ($service) use ($endpoint, $bearer_header){
$service
->wsdl($endpoint)
->trace(true)
->cache(0)
->options(
array('stream_context' => stream_context_create(
array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false
)
)
)
)
)
->classmap([
op_tem_direito_amm::class,
resultado::class,
])
->customHeader($bearer_header);
});
Thank you in advance.
Regards
anyone help ?????
not as yet