| Author |
How to Write a Java Client to consume REST webservice using POST method
|
Azahrudhin Mohammad
Greenhorn
Joined: Sep 04, 2012
Posts: 18
|
|
Hi Guys,
Could any one please help to post the java client to consume the REST webservice using POST method.
say I have web service like http://localhost:8080/MyWs/sayHello/ (as it is REST not wsdl)
Browser Call will be :
http://localhost:8080/MyWs/sayHello/Peter/Hai
http://localhost:8080/MyWs/sayHello?name=Peter&msg=Hai (In case of GET)
If I wanted to write java client how can i write. (How to pass the String or request parameter and make rest call , No wsdl)
|
Thanks and Regards,
azahrudhin.mohd@gmail.com
|
 |
Surender Suri
Ranch Hand
Joined: May 28, 2010
Posts: 41
|
|
|
You can use java.net.HttpUrlConnection (or) use apache client, check this http client
|
Thanks,
Suri
|
 |
Azahrudhin Mohammad
Greenhorn
Joined: Sep 04, 2012
Posts: 18
|
|
Hi Suri,
Thanks for the quick reply.
could you please advice on below code sinipet as I am already using the HttpUrlConnection but don't know how to pass the values as part of request.
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12269
|
|
See this Wikipedia article on the POST format.
The body of your POST request will consist of line after line of these name=value parameters.
Bill
|
Java Resources at www.wbrogden.com
|
 |
 |
|
|
subject: How to Write a Java Client to consume REST webservice using POST method
|
|
|