Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了使用SOAP API的android magento客户登录(身份验证)大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我尝试登录(认证)magento客户时遇到问题.我无法找到使用电子邮件和密码登录客户的正确方法.那么,你能告诉我如何使用SOAP API在magento商店中进行身份验证或登录客户.
我试过这个代码如下所示
env.dotNet = false;
            env.xsd = SoapserializationEnvelope.XSD;
            env.enc = SoapserializationEnvelope.ENc;

            SoapObject request = new SoapObject(NAMESPACE,"login");

            request.addProperty("username","xyz");
            request.addProperty("apiKey","xyz");

            env.setOutputSoapObject(request);

            httpTransportSE androidhttpTransport = new httpTransportSE(URL);
            androidhttpTransport.debug = true;
            androidhttpTransport.call("",env);
            Object result = env.getResponse();

            Log.d("sessionId",result.toString());

            // making call to get list of customers

            String sessionId = result.toString();
            request = new SoapObject(NAMESPACE,"customerCustomerInfo");
            request.addProperty("sessionId",sessionId);
            request.addProperty("customerId","2032");
            request.addProperty("email","abc@def.com");
            request.addProperty("password","password");


            env.setOutputSoapObject(request);
            androidhttpTransport.call(SOAP_ACTION,env);
            androidhttpTransport.debug = true;
            result = env.getResponse();

            Log.d("Customer List",result.toString());

}

但它没有帮助我,所以有任何人可以解决我的问题.

谢谢….

解决方法

没有直接选项将客户登录到magento.从API检索的密码是hash_password,您无法检查密码是否相等.但您可以使用下面介绍的方法@L_182_0@magento.

>创建一个外部PHP文件并访问那里的magento登录

require_once( ‘../ magentosite /应用/ Mage.PHP); // Magento之路
的umask(0);
法师::应用程式();

$id = 1;

尝试{$result = Mage :: getModel(‘customer / customer’) – > setWebsitEID($id) – > authenticate($email,$password);} catch(Exception $E){$result = false;}>使用JSON将用户名和密码从android发送到该PHP页面,并获得“结果”.>如果结果为“true”,则DB中存在用户名和密码.

大佬总结

以上是大佬教程为你收集整理的使用SOAP API的android magento客户登录(身份验证)全部内容,希望文章能够帮你解决使用SOAP API的android magento客户登录(身份验证)所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。