Thursday, March 1, 2012

Re: How to POST in REST web service

What sort of content are you getting back?
Would a RequestBuilder be right thing for you?
(http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html
# HTTP client types )


Am 1. März 2012 06:04 schrieb jayalakshmi jahagirdar
<jayalakshmi.jahagirdar@gmail.com>:
> 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) {
> sb.append(l);
> }
> br.close();
> } catch (Exception ex){
> ex.getMessage();
> }
> 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.
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment