Android httpclient calling restfull web service
according to following url I have created a requesthelper for calling a restfull webservice(.Net). http://as400samplecode.blogspot.com/2011/09/android-asynctask-httpclient-with.html
every time I call it from Android device it give error. in one of the topic at stackoverflow I suggest add '/' character at the end of the URL. You can find my url formats and given errors as listed below.
http://domain.com/default.svc/start/4ef8e420-e6a2-49f5-b612-c0b2dced0920/
at web browser it returns "End point not found". from the Android Log :
10-03 18:02:07.373: WARN/HTTP1:(3983): Not Found
10-03 18:02:07.383: WARN/HTTP3:(3983): java.io.IOException: Not Found
10-03 18:02:07.383: WARN/HTTP3:(3983): at requestHelper.doInBackground(requestHelper.java:84)
10-03 18:02:07.383: WARN/HTTP3:(3983): at requestHelper.doInBackground(requestHelper.java:1)
10-03 18:02:07.383: WARN/HTTP3:(3983): at android.os.AsyncTask$2.call(AsyncTask.java:185)
10-03 18:02:07.383: WARN/HTTP3:(3983): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
10-03 18:02:07.383: WARN/HTTP3:(3983): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
10-03 18:02:07.383: WARN/H开发者_JAVA百科TTP3:(3983): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
10-03 18:02:07.383: WARN/HTTP3:(3983): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
10-03 18:02:07.383: WARN/HTTP3:(3983): at java.lang.Thread.run(Thread.java:1096)
http://domain.com/default.svc/start/4ef8e420-e6a2-49f5-b612-c0b2dced0920
at web browser it returns a JSONObject as I wanted. from the Android Log :
10-03 18:03:41.683: WARN/HTTP1:(4023): Method Not Allowed
10-03 18:03:41.683: WARN/HTTP3:(4023): java.io.IOException: Method Not Allowed
10-03 18:03:41.683: WARN/HTTP3:(4023): at requestHelper.doInBackground(requestHelper.java:84)
10-03 18:03:41.683: WARN/HTTP3:(4023): at requestHelper.doInBackground(requestHelper.java:1)
10-03 18:03:41.683: WARN/HTTP3:(4023): at android.os.AsyncTask$2.call(AsyncTask.java:185)
10-03 18:03:41.683: WARN/HTTP3:(4023): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
10-03 18:03:41.683: WARN/HTTP3:(4023): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
10-03 18:03:41.683: WARN/HTTP3:(4023): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
10-03 18:03:41.683: WARN/HTTP3:(4023): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
10-03 18:03:41.683: WARN/HTTP3:(4023): at java.lang.Thread.run(Thread.java:1096)
精彩评论