I have an app where the user submits a form which performs a SOAP exchange to get some data from a Web API. If there are too many requests in a certain time, the Throttle server denies access. I have made a custom error view for this called throttle.blade.php
which is saved under resources\views\pages
. In routes.php
I have named the route as:
Route::get('throttle', 'PagesController@throttleError');
In PagesController.php
I have added the relevant function as:
public function throttleError() {
return view('pages.throttle');
}
Here is the SoapWrapper
class I have created to perform the SOAP exchanges:
<?php namespace App\Models;
use SoapClient;
use Illuminate\Http\RedirectResponse;
use Redirect;
class SoapWrapper {
public function soapExchange() {
try {
// set WSDL for authentication
$auth_url = "http://search.webofknowledge.com/esti/wokmws/ws/WOKMWSAuthenticate?wsdl";
// set WSDL for search
$search_url = "http://search.webofknowledge.com/esti/wokmws/ws/WokSearch?wsdl";
// create SOAP Client for authentication
$auth_client = @new SoapClient($auth_url);
// create SOAP Client for search
$search_client = @new SoapClient($search_url);
// run 'authenticate' method and store as variable
$auth_response = $auth_client->authenticate();
// add SID (SessionID) returned from authenticate() to cookie of search client
$search_client->__setCookie('SID', $auth_response->return);
} catch (\SoapFault $e) {
// if it fails due to throttle error, route to relevant view
return Redirect::route('throttle');
}
}
}
Everything works as it should until I reach the maximum number of requests allowed by the Throttle server, at which point it should display my custom view, but it displays the error:
InvalidArgumentException in UrlGenerator.php line 273:
Route [throttle] not defined.
I cannot figure out why it is saying that the Route is not defined.