5
我有一個應用程序,用戶提交表單執行SOAP交換以從Web API獲取一些數據。如果在特定時間內請求太多,則Throttle服務器拒絕訪問。我爲這個名爲throttle.blade.php
的自定義錯誤視圖保存了resources\views\pages
。在routes.php
我已經命名爲路線:在PagesController.php
我已經加入了相關的功能重定向到路由不工作在Laravel 5
Route::get('throttle', '[email protected]');
:
public function throttleError() {
return view('pages.throttle');
}
這裏是SoapWrapper
類我創建執行SOAP交流:
<?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');
}
}
}
一切正常,直到我達到Throttle服務器允許的最大請求數量,在此時它應該顯示m y自定義視圖,但它顯示錯誤:
InvalidArgumentException in UrlGenerator.php line 273:
Route [throttle] not defined.
我想不通它爲什麼說路由沒有定義。