0
I am trying to consume a WS through application in Aravel 5.6.
That’s the test code:
namespace App\Http\Controllers;
use SoapClient;
use Artisaninweb\SoapWrapper\Facades\SoapWrapper;
use Illuminate\Http\Request;
use App\Soap\Request\GetConversionAmount;
use App\Soap\Response\GetConversionAmountResponse;
use App\Soap;
use App\Soap\Response;
class EducacionalController extends Controller{
protected $soapWrapper;
public function index(Request $request){
$soap = SoapWrapper::add(function ($service) {
$service
->name('rmFametro')
->wsdl('http://sistemas.portaledu.com.br:8051/wsConsultaSQL/MEX?wsdl')
->options([
'login' => 'YYYYYYYY',
'password' => 'XXXXXXXX'
])
->trace(true);
});
$response = $soap->soapWrapper->call('RealizarConsultaSQL', [
'codSentenca' => '07',
'codColigada' => '1',
'codSistema' => 'S',
'parameters' => 'CPF=99999999999',
]);
var_dump($response);
}
}
And that’s the error of the test:
Undefined Property: Artisaninweb Soapwrapper Wrapper::$soapWrapper
My settings, in aap.php:
'providers' => [
...
Artisaninweb\SoapWrapper\ServiceProvider::class,
...
];
.
'aliases' => [
...
'SoapWrapper' => Artisaninweb\SoapWrapper\Facades\SoapWrapper::class
...
];
Where I can’t see error?
Error trying to instantiate: Soapwrapper.
syntax error, unexpected '$soap' (T_VARIABLE), expecting function (T_FUNCTION) or const (T_CONST)
– Milrak Pereira Pessoa
Used my code or adapted ?
– Jorge Costa
Mine is returning "Invalid User or Password! The user or password used for login is not valid for system access. Make sure the user code is correctly typed and write your password. Make sure the CAPS LOCK key is not accidentally pressed."
– Jorge Costa
I only adapted where you have: user and password. the rest is the same, you could provide the full class?
– Milrak Pereira Pessoa
I just put inside a closure inside a Route ex. Route::get('/', Function () { 'here'})
– Jorge Costa
What error are you getting
– Jorge Costa
I will add an addition to the question, with a picture illustrating the error!
– Milrak Pereira Pessoa
See the updated response
– Jorge Costa
To instantiate a new Soapwrapper you must use the constructor
– Jorge Costa
Let’s go continue this discussion in chat.
– Milrak Pereira Pessoa