At execution this throws an error in line 'HttpResponse response = client.execute(request);' Is there a better method to use a REST webservice from within Xpert.ivy? asked 18.02.2014 at 17:52 Björn Flavio Sadeghi ♦♦ |
REST is supported by Axon.ivy since 6.1 out of the box. The Axon.ivy Designer comes with a sample project called 'ConnectivityDemos' where the REST capabilities are demonstrated. See also the documentation about how to provide or call a REST service from Axon.ivy: http://developer.axonivy.com/doc/latest/DesignerGuideHtml/ivy.integration.html#ivy-integration-rest For Axon.ivy 6.0 and older Unfortunately REST Web Services are not supported by default yet. But you can use a JAX-RS client library like Jersey to call REST Web Services. To do this, simple add the needed jersey libraries (.jar files) to your project. Then add the jar files to the Java Classpath (Switch to Java perspective. Select the jar file and use the context menu Build Path > Add to Build Path). After that you can access the classes provided by the library from your own java classes but also from ivyScript. See Jersey user documentation chapter Client API to learn how to use it. Sample project which makes a google search via Rest API: RestFulWebService.iar
link
This answer is marked "community wiki".
answered 20.02.2014 at 09:11 Reto Weiss ♦♦ Reguel Werme... ♦♦ Hi Reto. Unfortunately it seems that this solution doesn't work anymore with Axon.ivy Engine 5.1.0. I tried adding the jars to my project and I also tried the RestFulWebService.iar from the other post. Both work in the Designer, but in the Engine I get an exception "java.lang.NoClassDefFoundError: Could not initialize class com.sun.jersey.core.header.MediaTypes". As soon as I add the jersey jars to the servers lib/shared folder it works again (but that's not a clean solution). Seems to be a ClassLoader/Isolation issue. Any ideas or hints?
(13.10.2014 at 13:08)
DanielGauch
I guess that your class loading issue can be solved by using a specific context-classLoader as described here: http://answers.axonivy.com/questions/945/not-visible-interface-on-persistence-query/948
(17.10.2014 at 10:23)
Reguel Werme... ♦♦
In Ivy 6.0 and higher there is already Jersey 2 included! Therefore the examples here with Jersey 1 does not work. On Designer it works, but on Server you get the mentioned error about the media-types missing. The error can occur in different forms. Solution is to use the Jersey 2 libs directly. So it works on the server also. See the site for migration or the Ivy 6.2 Example-project "Connectivity Demo". Site: https://jersey.java.net/documentation/latest/migration.html#mig-1.x
(13.08.2016 at 02:52)
Helmut Burge...
|
Once you sign in you will be able to subscribe for any updates here
By RSS:Markdown Basics
Tags:
Asked: 18.02.2014 at 17:52
Seen: 7,703 times
Last updated: 14.11.2016 at 09:13