PHP code example of radomirradojevic / yii2-wss-soap

1. Go to this page and download the library: Download radomirradojevic/yii2-wss-soap 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/ */

    

radomirradojevic / yii2-wss-soap example snippets


'components' => [
    'soapClient' => [
        'class' => \radomirradojevic\soap\SoapClientWrapper::className(),
        'url' => '<SOAP_WSDL_URL>',
        // SoapClient options
        'options' => [
            'cache_wsdl' => WSDL_CACHE_NONE,
            'debug' => true,
        ],
        // SopaClient headers, object or closure
        'headers' => function() {
            $headers = new stdClass();
            $headers->authDetails = new stdClass(); // This is node in SOAP Header where the login and password.
			$headers->authDetails->wss_ns = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd';
            $headers->authDetails->login = '<LOGIN>';
            $headers->authDetails->password = '<PASSWORD>';
            return $headers;
        }
    ],
    ...
]

try {
    $soap = Yii::$app->soapClient;
    $result = $soap->makeSmb(['arg1' => 'foo', 'arg2' => 'bar']);
} catch (SoapClientWrapperException $e) {
    return ['request' => $soap->getLastRequest(), 'response' => $soap->getLastResponse()];
}