【发布时间】:2015-03-30 15:47:57
【问题描述】:
我正在使用 laravel 4 框架和 magento api soap。这是我的登录方法:
public function APIauthentication( $apiUser, $apiKey ) {
$error = array();
if( empty( $apiUser ) ) {
$error[] = 'Unknown api user';
}
if( empty( $apiKey ) ) {
$error[] = 'Invalid api key';
}
if( empty( $error ) ) {
$client = $this->_getClient();
$token = $client->login( $apiUser, $apiKey );
$this->_setToken( $token );
return $this->_apiJsonResult( $token );
} else {
return $this->_apiJsonResult( $error );
}
}
现在我进入 laravel 屏幕 SoapFault 访问被拒绝。
如果 url 不正确或 API 用户/密钥不正确,我需要返回错误字符串。
像这样:
return Redirect::to('user/stores/magento/')->with('status', 'apie user or key is incorrect');
如何做到这一点?有故障代码,但我不知道如何记录 http://www.magentocommerce.com/api/soap/introduction.html#Introduction-GlobalAPIFaults
【问题讨论】:
标签: php api magento laravel soap