soap-client icon indicating copy to clipboard operation
soap-client copied to clipboard

Bug in example

Open tomasz-kusy opened this issue 5 years ago • 4 comments

Hi! I've tried to run example script from readme.md section 'Using the client'. Unsuccessfully. I finally got it started. I had to change: $metadata = $container->get('goetas_webservices.soap_client.metadata_reader'); to $metadata = $container->get('goetas_webservices.soap_client.metadata_loader.array');

It's a bug or?

tomasz-kusy avatar Feb 20 '20 10:02 tomasz-kusy

are you sure about this... if you check https://github.com/goetas-webservices/soap-client/blob/master/.travis.yml#L28 we are testing exactly that case

see https://github.com/goetas-webservices/soap-client/blob/master/tests/example.php#L24

goetas avatar Mar 07 '20 08:03 goetas

I'm not sure but...

user@DESKTOP-UU4MHEL MINGW64 /c/xxx
$ git clone https://github.com/goetas-webservices/soap-client.git
Cloning into 'soap-client'...
remote: Enumerating objects: 28, done.
remote: Counting objects: 100% (28/28), done.
remote: Compressing objects: 100% (23/23), done.
Receiviremote: Total 987 (delta 9), reused 7 (delta 2), pack-reused 959
Receiving objects: 100% (987/987), 234.07 KiB | 339.00 KiB/s, done.
Resolving deltas: 100% (544/544), done.

$ cd soap-client/
$ composer install
Package operations: 66 installs, 0 updates, 0 removals
(...)
Writing lock file
Generating autoload files

$ php bin/soap-client generate tests/Fixtures/config.yml soap/src/Container --dest-class=TestNs/Container/SoapClientContainer

$ php tests/example.php
PHP Fatal error:  Uncaught Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The "goetas_webservices.soap_client.metadata_reader" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead. in C:\xxx\soap-client\vendor\symfony\dependency-injection\Container.php:269
Stack trace:
#0 C:\xxx\soap-client\vendor\symfony\dependency-injection\Container.php(225): Symfony\Component\DependencyInjection\Container->make('goetas_webservi...', 1)
#1 C:\xxx\soap-client\tests\example.php(24): Symfony\Component\DependencyInjection\Container->get('goetas_webservi...')
#2 {main}
  thrown in C:\xxx\soap-client\vendor\symfony\dependency-injection\Container.php on line 269

Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The "goetas_webservices.soap_client.metadata_reader" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead. in C:\xxx\soap-client\vendor\symfony\dependency-injection\Container.php on line 269

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The "goetas_webservices.soap_client.metadata_reader" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead. in C:\xxx\soap-client\vendor\symfony\dependency-injection\Container.php on line 269

Windows 10

$ php -v
PHP 7.3.7 (cli) (built: Jul  3 2019 14:34:10) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.7, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v2.9.1, Copyright (c) 2002-2020, by Derick Rethans```

tomasz-kusy avatar Mar 09 '20 22:03 tomasz-kusy

I hit this issue too, and fixed it with https://github.com/goetas-webservices/soap-client/commit/99940e1df677c79200a1429ed0fa52183b187346.

Toilal avatar Aug 24 '20 18:08 Toilal

It only occurs when using Symfony 3.4+, because services and aliases are private by default since this version.

Toilal avatar Aug 24 '20 18:08 Toilal