Skip to content

Conversation

devloic
Copy link

@devloic devloic commented May 28, 2023

As an enhancement (?) , for those who need to change the http header globally, we could allow stream_context to be passed through options once so it would not be necessary to call setHttpHeader() before each request.

The code for including some header would be :

$options = array(
\WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => 'https://somewebservice?wsdl',
\WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => ClassMap::get(),
);

$aHTTP['http']['header'] = "myheader: myheadervalue"; $context = stream_context_create($aHTTP);
$options2=array_merge($options,array("stream_context" => $context));

$someservice = new \ServiceType\SomeServiceClass($options2);

includes fix from fougere2713/42_php8_compatibility_fix

Anthony Donnefort and others added 5 commits December 9, 2022 15:29
As an enhancement (?) , for those who need to change the http header globally, we could allow stream_context to be passed through options once so it would not be necessary to call setHttpHeader() before each request.

The code for including some header would be : 

$options = array(
   \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_URL => 'https://somewebservice?wsdl',
    \WsdlToPhp\PackageBase\AbstractSoapClientBase::WSDL_CLASSMAP => ClassMap::get(),
);

$aHTTP['http']['header'] =  "myheader: myheadervalue";
$context = stream_context_create($aHTTP);
$options2=array_merge($options,array("stream_context" => $context));

$someservice = new \ServiceType\SomeServiceClass($options2);
using isset to avoid warning
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

Successfully merging this pull request may close these issues.

1 participant