<p>A simple question, but could someone provide sample code as to how would someone call a web service from within the JBoss Seam framework, and process the results?</p>

<p>I need to be able to integrate with a search platform being provided by a private vendor who is exposing his functionality as a web service. So, I'm just looking for some guidance as to what the code for calling a given web service would look like. </p>

<p>(Any sample web service can be chosen as an example.)</p>

[{'answer_id': 57090, 'author': 'Hank Gay', 'author_id': 4203, 'author_profile': 'https://Stackoverflow.com/users/4203', 'pm_score': 0, 'selected': False, 'text': '<pre><code>import org.restlet.Client;\nimport org.restlet.data.Protocol;\nimport org.restlet.data.Reference;\nimport org.restlet.data.Response;\nimport org.restlet.resource.DomRepresentation;\nimport org.w3c.dom.Node;\n\n/**\n * Uses YAHOO!\'s RESTful web service with XML.\n */\npublic class YahooSearch {\n    private static final String BASE_URI = "http://api.search.yahoo.com/WebSearchService/V1/webSearch";\n\n    public static void main(final String[] args) {\n        if (1 != args.length) {\n            System.err.println("You need to pass a search term!");\n        } else {\n            final String term = Reference.encode(args[0]);\n            final String uri = BASE_URI + "?appid=restbook&amp;query=" + term;\n            final Response response = new Client(Protocol.HTTP).get(uri);\n            final DomRepresentation document = response.getEntityAsDom();\n\n            document.setNamespaceAware(true);\n            document.putNamespace("y", "urn:yahoo:srch");\n\n            final String expr = "/y:ResultSet/y:Result/y:Title/text()";\n            for (final Node node : document.getNodes(expr)) {\n                System.out.println(node.getTextContent());\n            }\n        }\n    }\n}\n</code></pre>\n\n<p>This code uses <a href="http://www.restlet.org/" rel="nofollow noreferrer">Restlet</a> to make a request to Yahoo\'s RESTful search service. Obviously, the details of the web service you are using will dictate what your client for it looks like.</p>\n'}, {'answer_id': 57163, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': "<pre><code>final Response response = new Client(Protocol.HTTP).get(uri);\n</code></pre>\n\n<p>So, if I understand this correctly, the above line is where the actual call to the web service is being made, with the response being converted to an appropriate format and manipulated after this line.</p>\n\n<p>Assuming I were not using Restlet, how would this line differ?<br>\n<em>(Of course, the actual processing code would be significantly different as well, so that's a given.)</em></p>\n"}, {'answer_id': 58591, 'author': 'Hank Gay', 'author_id': 4203, 'author_profile': 'https://Stackoverflow.com/users/4203', 'pm_score': 2, 'selected': True, 'text': '<p>There\'s roughly a gajillion HTTP client libraries (Restlet is quite a bit more than that, but I already had that code snippet for something else), but they should all provide support for sending GET requests. Here\'s a rather less featureful snippet that uses <a href="http://hc.apache.org/httpclient-3.x/tutorial.html" rel="nofollow noreferrer">HttpClient</a> from Apache Commons:</p>\n\n<pre><code>HttpClient client = new HttpClient();\nHttpMethod method = new GetMethod("http://api.search.yahoo.com/WebSearchService/V1/webSearch?appid=restbook&amp;query=HttpClient");\nclient.executeMethod(method);\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/56865', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']