Questions Tagged With resthttps://answers.axonivy.com/tags/rest/?type=rss&user=Bj%C3%B6rnquestions tagged <span class="tag">rest</span>enTue, 18 Feb 2014 17:52:38 -0500Calling REST Webservice (HTTP GET)https://answers.axonivy.com/questions/527/calling-rest-webservice-http-get<pre><code>I'm trying to use a currency converter in Xpert.ivy: http://rate-exchange.appspot.com. This service is called like this: http://rate-exchange.appspot.com/currency?from=EUR&amp;to=CHF and gives a response like this: {"to": "CHF", "rate": 1.2223900000000001, "from": "EUR"}. I would like this to call in a script step. So far I tried the method described in http://www.javacodegeeks.com/2012/09/simple-rest-client-in-java.html: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet("http://rate-exchange.appspot.com/currency?from=EUR&amp;to=CHF"); HttpResponse response = client.execute(request); BufferedReader rd = new BufferedReader (new InputStreamReader(response.getEntity().getContent())); String line = ""; while ((line = rd.readLine()) != null) { out.SOME_STRING_DATATYPE = line; } </code></pre> <p>At execution this throws an error in line 'HttpResponse response = client.execute(request);'</p> <p>Is there a better method to use a REST webservice from within Xpert.ivy?</p>BjörnTue, 18 Feb 2014 17:52:38 -0500https://answers.axonivy.com/questions/527/calling-rest-webservice-http-getrest