Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Authorization header #181

Open
betohorta opened this issue Apr 1, 2020 · 2 comments
Open

HTTP Authorization header #181

betohorta opened this issue Apr 1, 2020 · 2 comments

Comments

@betohorta
Copy link

betohorta commented Apr 1, 2020

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
in my header.

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

@shinnachot
Copy link

anyone help ?????

@betohorta
Copy link
Author

not as yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants