In what scenarios would PHP developers need to include the SOAP header in every call to establish a connection?

When using SOAP in PHP, developers may need to include the SOAP header in every call to establish a connection if the web service requires authentication or specific data to be passed in the header for each request. This is commonly needed for APIs that require a token or authentication credentials to be included in the SOAP header for each request.

// Create a new SoapClient instance
$client = new SoapClient("https://example.com/api?wsdl");

// Set the SOAP header with the necessary authentication credentials
$header = new SoapHeader('https://example.com/api', 'Authentication', ['token' => 'your_token']);
$client->__setSoapHeaders($header);

// Make a SOAP call with the header included
$response = $client->someMethod();