获取SoapFault - faultcode:' SOAP-ENV:Server' faultstring:'程序'登录'不存在' faultactor:' null' detail:null错误

时间:2015-03-26 11:50:24

标签: android magento soap

我想在Android代码中调用Magento Soap v2 API方法。为此,我需要根据此http://www.magentocommerce.com/api/soap/catalog/catalogCategory/catalog_category.tree.html

的session_id

我已尝试使用此代码获取session_id,但收到错误“过程”登录“不存在”。我是新手使用Soap v2 API。

请求:

private static final String NAMESPACE = "urn:Magento";
private static final String Method_Name="login";
private static final String URL ="http://localhost/magento/index.php/api/v2_soap/";
private static final String SOAP_ACTION ="urn:Magento/login";

        try {

        SoapSerializationEnvelope envelopes = new SoapSerializationEnvelope(
                                SoapEnvelope.VER11);
        envelopes.dotNet = false;
        envelopes.xsd = SoapSerializationEnvelope.XSD;
        envelopes.enc = SoapSerializationEnvelope.ENC;
        SoapObject request = new SoapObject(NAMESPACE, Method_Name);
        request.addProperty("username", "xxxxxx");
        request.addProperty("apiKey", "xxxxxxx");
        envelopes.setOutputSoapObject(request);

        HttpTransportSE httpTransportSE = new HttpTransportSE(URL);
        httpTransportSE.debug = true;
        httpTransportSE.call(SOAP_ACTION, envelopes);
        Object result = envelopes.getResponse();
        Log.d("sessionId", result.toString());

        } catch (Exception e) {
             e.printStackTrace();
        }

回应:

SoapFault - faultcode: 'SOAP-ENV:Server' faultstring: 'Procedure 'login' not present' faultactor: 'null' detail: null

1 个答案:

答案 0 :(得分:0)

你现在试试这个。

http://your machine IP address /magento/index.php/api/soap

而不是

http://localhost/magento/index.php/api/v2_soap