Wednesday, February 29, 2012

How to POST in REST web service

Hi all,
I am trying to  make a REST call to get the response from Web Service. The code is as below and it works.
public static String makeRestCall(String service)  {
StringBuilder sb = new StringBuilder();
String baseURL = urlsrc;
try {
//set URL
URL url = new URL(baseURL + service);
//make connection
URLConnection urlc = url.openConnection();
BufferedReader br = new BufferedReader(new InputStreamReader(urlc.getInputStream()));
String l = null;
while ((l=br.readLine())!=null) {
} catch (Exception ex){
return sb.toString();

But what are the changes that i need to make so that i can make  a POST call to Web service.
Any help is appreciated.


You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment