vendredi 2 novembre 2018

php laravel SoapClient ErrorException Array to string conversion

public static function tracking($tracking_id)
{    
    ini_set("soap.wsdl_cache_enabled", "0");
    $path_to_wsdl = Fedex::pathToWsdl().'TrackService_v12.wsdl';
    $client = new SoapClient($path_to_wsdl, array('trace' => 1)); 
    $request = Fedex::BasicRequest();
    $request['TransactionDetail'] = array('CustomerTransactionId' => '*** Tracking Request using PHP ***');
    $request['Version'] = Fedex::requestVersion('trck','12','0','0');
    $request['SelectionDetails'] = array(
        'PackageIdentifier' => array(
            'Type' => 'TRACKING_NUMBER_OR_DOORTAG',
            'Value' => $tracking_id
        )    
    );   
    $request['ProcessingOptions'] = array('INCLUDE_DETAILED_SCANS' => TRUE);

    try {
        if(setEndpoint('changeEndpoint')){
            $newLocation = $client->__setLocation(setEndpoint('endpoint'));
        }    

        $response = $client ->track($request);
        //dd($response);    

This is partial code. The error pointed to line $response = $client ->track($request);. The error only happens when $request['ProcessingOptions'] is there. If I remove this line, or change the name to $request['ProcessingOption'] or some other names, the error will be gone. Don't know why and how do i debug?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire