I am developing a client-side Java application that has a bit of functionality that requires getting data from some web services that transmit in JSON (some RESTful, some not). No JavaScript, no web browser, just a plain JAR file that will run locally with Swing for the GUI.
This is not a new or unique problem; surely there must be some open source libraries out there that will handle the JSON data transmission over HTTP. I've already found some that will parse JSON, but I'm having trouble finding any that will handle the HTTP communication to consume the JSON web service.
So far I've found Apache Axis2 apparently which might have at least part of the solution, but I don't see enough documentation for it to know if it will do what I need, or how to use it. Maybe part of the problem is that I don't have experience with web services so I'm not able to know a solution when I see it. I hope some of you can point me in the right direction. Examples would be helpful.
If you want a little bit more comfort than having to deal with URLConnection, check out Resty for Java. Simple, light-weight, but still pretty new.
http://beders.github.com/Resty
Here is an example for JSON:
Resty r = new Resty();
String name = r.json("http://ws.geonames.org/postalCodeLookupJSON?"+
"postalcode=66780&country=DE").get("postalcodes[0].placeName").toString();
No dependencies. One small JAR and you are good to go.