0

我在 android 中调用 Soap API 并收到以下错误,

SoapFault - faultcode: '2' faultstring: 'Access denied.' faultactor: 'null' detail: null
at org.ksoap2.serialization.SoapSerializationEnvelope.parseBody(SoapSerializationEnvelope.java:141)
at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:140)
at org.ksoap2.transport.Transport.parseResponse(Transport.java:100)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:214)
at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:96)
at com.magentodemo.customer.MagentoCustomer$GetCustomerDetailsTask.doInBackground(MagentoCustomer.java:714)
at com.magentodemo.customer.MagentoCustomer$GetCustomerDetailsTask.doInBackground(MagentoCustomer.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:264)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)

我想从此 SoapFault 中检索拒绝访问消息,

我怎样才能得到那个消息?

4

2 回答 2

2

我得到了我的问题的解决方案,

我有以下代码

private class Login extends AsyncTask<Void, Integer, String> {

    @Override
    protected void onPreExecute() {

    }

    @Override
    protected void onPostExecute(String result) {

    }

    @Override
    protected String doInBackground(Void... params) {
        try {

            // Soap Call

        } catch (SoapFault fault) {
            Log.v("TAG", "soapfault = "+fault.getMessage());

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

我只是为 SoapFault 添加了 Catch 块,然后我得到了故障字符串,就是这样。

于 2013-04-23T09:46:33.857 回答
1

您是否尝试过 SoapFault 类 API 的方法来满足您的要求?请从以下链接检查各自:http: //docs.oracle.com/javaee/5/api/javax/xml/soap/SOAPFault.html#getFaultString()

于 2013-04-22T11:16:15.340 回答