请建议任何解决方案? 我是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();
}
}
答案 0 :(得分:0)
答案 1 :(得分:0)