Closed waqas-mehmood-pk closed 6 years ago
That's not the correct way to use it.
Here is how to use it:
$this->soapWrapper->client('SoapService', function ($client) {
Log::info($client->getLastResponse());
});
hi @nishpatel i tried to use the getlastrequest method in the way you said, but i have this error, could you help me with this? please!!!
Class 'App\Http\Controllers\cons\fina\cfem\Log' not found
this is my code
<?php
namespace App\Http\Controllers\cons\fina\cfem;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DB;
use DataTables;
USE Carbon\Carbon;
use Artisaninweb\SoapWrapper\SoapWrapper;
class consfinacfemController extends Controller
{
public function descargarCFD(request $request){
$peticion="";
$this->soapWrapper->add('Evento', function ($service) {
$service
->wsdl('http://www.test.com.mx/php/wsv/wsv-srv.php?wsdl')
->trace(true)
->classmap([
consultarTransporte::class
]);
});
// Without classmap
$datosU=array( 'usuario'=>'',
'correo'=>'tech@terminal.com',
'password'=>'ter.01');
$parametros=array( 'datosusuario' => $datosU,
'codigotransporte' => '1',
'transportista' => '',
'placas' => '');
$response = $this->soapWrapper->call('Evento.consultarTransporte', [$parametros]);
$peticion=$this->soapWrapper->client('Evento', function ($client) {
Log::info($client->getLastRequest());
});
return response()->json(['codigo'=>200, 'datos'=>$response,'peticion'=>$peticion]);
}
}
because Log is not declared! You need this:
use Illuminate\Support\Facades\Log;
For example...
my bad, thank you!
can i catch the response in the way i use it?
i getting "null" in the var $peticion
@artisaninweb can you give me a piece of advice? please!
Note: This method works only if the SoapClient object was created with the trace option set to TRUE. Source: http://php.net/manual/en/soapclient.getlastresponse.php
So add the option trace if you want to use the getLastResponse method.
My request:
after calling
call
method ofsoapWrapper
i want to use__getLastRequest()
Log::info( [ "XML response : " => $this->soapWrapper->__getLastRequest() ."\n" ] );
but whn i trying to call following error occured.
Call to undefined method Artisaninweb\SoapWrapper\SoapWrapper::__getLastRequest()