在android中使用rest调用web服务的正确方法?

在android中使用rest调用web服务的正确方法?,android,Android,请提出解决方案? 我是android新手。调用web服务时出错 W/System.err﹕ java.io.IOException: Method Not Allowed 下面是我的活动,它调用一个web服务(方法),该服务接受一个字符串参数并给出输出。若有人使用asynctask发布代码片段,我会很高兴,因为这是在android中调用服务的最佳方式 public class closingBalance extends ActionBarActivity { protected fi

请提出解决方案? 我是android新手。调用web服务时出错

W/System.err﹕ java.io.IOException: Method Not Allowed
下面是我的活动,它调用一个web服务(方法),该服务接受一个字符串参数并给出输出。若有人使用asynctask发布代码片段,我会很高兴,因为这是在android中调用服务的最佳方式

public class closingBalance extends ActionBarActivity {
    protected final String NAMESPACE = "http://xxxxx/";

    protected final String METHOD_NAME = "getReportDetails";
    protected final String URL = "http://xxxxx?wsdl?shop_num=12345";

    HttpClient client = new DefaultHttpClient();
    try {
        HttpResponse res = client.execute(new HttpGet(URL));
        StatusLine line  = res.getStatusLine();
        if(line.getStatusCode() == HttpStatus.SC_OK){
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            res.getEntity().writeTo(out);
            String response = out.toString();
            System.out.println(response);
            out.close();

        }else{
            res.getEntity().getContent().close();
            throw  new IOException(line.getReasonPhrase());
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}

我建议你研究一下截击工具,它对你很有用

使用截击传输网络数据非常简单

考虑使用库


是AsyncTask、Volley和Reformation之间的比较

但是此web服务有wsdl文件,我如何使用rest使用它?但是此web服务有wsdl文件,我如何使用rest、Volley或Reformation使用它?