How I can call rest web service on click of btn returning json format, need show values out of that json format in few fields on the form?
However, the way we typically do this is to create a Dynamic Data Service on Transaction Manager that accesses the REST service and returns the data to the form. These services need to be coded in Groovy and will require some programming skills.There is a bunch of documentation available on the Avoka Community that deals with this, E.g.:
In Transact 5, developers can build these Groovy services in an IDE of their choice - more info.
Were you able to get this working Leena?
I am trying to call REST by creating a Dynamic Data Service on Transaction Manager that accesses the REST service and returns the data to the form. I am using the following line of codes::
import com.avoka.core.groovy.GroovyLogger as logger
def username = "subhojit_bose_ibm" def password = "subhojit_bose_ibm" def params = [:] //def params.meternumber = meternumber // execute GET request and return a HttpResponse object def response = new GetRequest('http://esp-rip-nonprod-vip:8044/rest/meter/10M7413') .setBasicAuth(username, password) .execute()
logger.info "execute: "
But while running and checking groovy script logs, I am ablr to see unknown host error. Could any body help or suggest the reason and the solution.Can we raise ticket with Avoka?
Hey Leena, the unknown host error would suggest that the server with the REST service is not accessible from the Avoka server. This is a network issue within your on-premise environment and not something that Avoka would be able to resolve. I suggest you speak with your IT team or the owner of the REST service to see if they can resolve the networking issue in the first instance.
ok Thanks Ben!!
Were you able to make this work? I am trying a similar approach to call a REST Webservice using Transaction Manager. I keep getting below error:
com.avoka.core.groovy.GroovyScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 11: unable to resolve class com.avoka.component.http.GetRequest
@ line 11, column 1.
The Avoka TM Version we are using is 4.0.7 Build Number 37608 Number of Active Forms: 8
Which Avoka Version are you using?