System.err:org.ksoap2.transport.HttpResponseException:HTTP请求失败,HTTP状态:301

时间:2019-07-16 07:11:27

标签: magento-1.7 httpresponse ksoap2 android-ksoap2

我收到org.ksoap2.transport.HttpResponseException:HTTP请求失败,HTTP状态:301错误,当我在httpTransportSE调用函数中调用url时!!

我正在尝试通过AsynTask侦听器从Magento Soap api版本2 wsdl中获得响应...!

Wsdl网址链接:http://example.com/api/v2_soap?wsdl

我的代码示例:

String wsdl_url = "http://example.com/api/v2_soap";
String soap_action = "urn:Magento/loginParam";
String name_space = "urn:Magento";
String method_name = "loginParam";

try {

        SoapObject complexFilter = new SoapObject(name_space, method_name);
        complexFilter.addProperty("username", "NAme");
        complexFilter.addProperty("apiKey", "something");

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(complexFilter);

        HttpTransportSE httpTransportSE = new HttpTransportSE(wsdl_url);

        httpTransportSE.call(soap_action, envelope);

        Object result = envelope.getResponse();
        response = result.toString();
        System.out.println("Soap Session Id Response: " + response);

    } catch (Exception e){
        e.printStackTrace();
        System.out.println("Exception: "+e);
    }

我的错误:

W/System.err: org.ksoap2.transport.HttpResponseException: HTTP request failed, HTTP status: 301
    at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:235)
    at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118)

0 个答案:

没有答案