PHP code example of hengebytes / soap-core-async-bundle
1. Go to this page and download the library: Download hengebytes/soap-core-async-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hengebytes / soap-core-async-bundle example snippets
// src/Middleware/CustomSoapHeaderMiddleware.php
namespace App\Middleware;
use Hengebytes\SettingBundle\Interfaces\SettingHandlerInterface;
use Hengebytes\WebserviceCoreAsyncBundle\Middleware\RequestModifierInterface;
use Hengebytes\WebserviceCoreAsyncBundle\Request\WSRequest;
use Soap\Xml\Builder\SoapHeader;
use function VeeWee\Xml\Dom\Builder\children;
use function VeeWee\Xml\Dom\Builder\namespaced_element;
use function VeeWee\Xml\Dom\Builder\value;
readonly class SoapHeaderRequestModifier implements RequestModifierInterface
{
public function modify(WSRequest $request): void
{
$tns = 'http://htng.org/1.1/Header/';
$request->setHeaders([
new SoapHeader(
$tns,
'hb322:HTNGHeader',
children(
namespaced_element($tns, 'hb322:From', children(
namespaced_element($tns, 'hb322:systemId', value('APPTEST')),
namespaced_element($tns, 'hb322:Credential', children(
namespaced_element($tns, 'hb322:userName', value('someUsername')),
namespaced_element($tns, 'hb322:password', value('somePassword'))
)
)
)
),
namespaced_element($tns, 'hb322:timeStamp', value(date('c')))
)
),
]);
}
public function supports(WSRequest $request): bool
{
return $request->webService === 'YourServiceName' && $request->subService === 'YourSubServiceName';
}
public static function getPriority(): int
{
return 0;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.