i want to request wfc service by using url and i add three parameter in url it was error in run time illegal argument exception
String myUrl;
myUrl = String.format("http://10.0.2.2:51382/RestServiceImpl.svc/jsons/? Location=%s&GROUP=%s&asondate=%s",items,items1,finalDate);
logcat
07-03 10:04:31.602: E/AndroidRuntime(2790): java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.androidhive.innovate/com.androidhive.innovate.AndroidJSONParsingActivity}: java.lang.IllegalArgumentException: Illegal character in query at index 49: http://10.0.2.2:51382/RestServiceImpl.svc/jsons/? Location=ArihantWanarpet&GROUP=ArihantShowroom&asondate=2013-07-03
You've got a space in your URL, after the ?
. Get rid of it, and I suspect you'll fine all is well. So this:
"http://10.0.2.2:51382/RestServiceImpl.svc/jsons/? Location=%s&GROUP=%s&asondate=%s"
becomes
"http://10.0.2.2:51382/RestServiceImpl.svc/jsons/?Location=%s&GROUP=%s&asondate=%s"
Do this:
OR
String myUrl;
myUrl = String.format("http://10.0.2.2:51382/RestServiceImpl.svc/jsons/? Location=%s&GROUP=%s&asondate=%s",items,items1,finalDate);
String url = URLEncoder.encode(myUrl, utf-8);
System.out.println(url);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.