'Problem with communication with web service

For the past few days I've been trying to connect to web service with soap. This is the configurations that I try to pass to SOAP:

$config['soap_parameters'] = [
            'cache_wsdl' => 0,
            'trace' => 1,
            'stream_context' => stream_context_create(
                [
                    'ssl' => [
                        'verify_peer' => 0,
                        'verify_peer_name' => 0,
                        'allow_self_signed' => 1,
                        'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
                    ]
                ]
            ),
            'login' => 'Username',
            'password' => 'Password'
        ];

$this->configureSoapClient($config, $container);

When I try to sync web service client, I get an error saying Unable to dump a service container if a parameter is an object or a resource. When I've tried to look where's the issue, I've found out that stream_context_create was the problem, because it returns resource and error states, that it doesn't like when you give object or resource. I tried to look for alternative for stream_context_create method, but, unfortunately, seems that there's no alternative for it. Maybe some of you encountered problem like this and have a solution for this? Thank you in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source