3

I have a web service exposed to me which returns a json object.

I've been provided with a url http://address.to.web.service:8080/game If enter this in any browser i get a json output.

In my code, I've already implemented logic to populate a web page but using a local json file.

I now need to wire it up with the output of the web service.

Can someone help me understand what might be the simplest way to go for this problem?

Marcel Stör
  • 22,695
  • 19
  • 92
  • 198
webExplorer
  • 1,025
  • 2
  • 17
  • 33
  • Not sure if this is correct, but, Is parsing a JSON using a url the same as getting JSON output from a webservice? – webExplorer Apr 15 '14 at 19:29
  • Define "webservice"... Invoking `http://address.to.web.service:8080/game` and processing its response sounds like "getting JSON output from a webservice". If you can enter that URL in your browser and see JSON then this is "parsing a JSON using a URL". – Marcel Stör Apr 15 '14 at 19:34

1 Answers1

1

You need to connect to your webservice, read the full response and convert it to a JSON array. You do not specify which part of the problem you're having problems with.

Ayrad
  • 3,996
  • 8
  • 45
  • 86
  • Since doing this for first time, reading a lot and getting confused! I saw there is wsimport but not sure if that is the best option in this case? – webExplorer Apr 15 '14 at 19:26
  • tried wsimport, but since the webservice doesnt generate a wsdl... i'm not able to create the client code using wsimport. – webExplorer Apr 15 '14 at 19:34
  • don't know about wsimport but this might help http://www.javacodegeeks.com/2012/09/simple-rest-client-in-java.html – Ayrad Apr 15 '14 at 19:36