Here we will use “java.net.URL” and “java.net.HttpURLConnection” to create a simple Java client to send “GET” and “POST” request.
NOTE: Same way, by using "POST" method we can create Java Client using java.net.URL with few changes in the above code.
GET Request
REST service that return “json” data back to client.Java client to send a “GET” request:
Output:Output from Server .... {"qty":999,"name":"iPad 3"}
NOTE: Same way, by using "POST" method we can create Java Client using java.net.URL with few changes in the above code.
0 comments:
Post a Comment