Hello,
I am trying to call an RTDM flow on a different server via RESTful call. Please see code below:
// @Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1')
import groovyx.net.http.Method
import groovyx.net.http.RESTClient
import org.apache.http.entity.StringEntity
import groovyx.net.http.HttpResponseException
class callmpgPortout implements Runnable {
// Input variables
String MSISDN;
Date REQUEST_START_TIME;
String NP_TXN_ID;
String PORT_ID;
String LOG_ID;
String OLO;
String VARIABLE1;
String VARIABLE2;
String VARIABLE3;
String VARIABLE4;
String VARIABLE5;
// Output variables
String MSGCODE;
String MSGDESC;
private Long status;
public void run() {
def client = new RESTClient( 'http://sgbdcmpweb01:7980/RTDM/rest/runtime/decisions' )
def resp = client.post( path : '/mpgPortout' ,
query: [decisionId: 'mpgPortout'],
requestContentType : 'application/json',
body : '{ \n' +
' "clientTimeZone": "GMT",\n' +
' "version": 1,\n' +
' "inputs": {"MSISDN":MSISDN,"REQUEST_START_TIME":REQUEST_START_TIME,"NP_TXN_ID":NP_TXN_ID,"PORT_ID" : PORT_ID,"LOG_ID":LOG_ID,"OLO" : OLO,"VARIABLE1":VARIABLE1,"VARIABLE2":VARIABLE2,"VARIABLE3":VARIABLE3,"VARIABLE4":VARIABLE4,"VARIABLE5":VARIABLE5\n' +
' \t"TestPath" : 1\n' +
' }\n' +
'}'
)
status = resp.status;
}
public Long getStatus() {
return status;
}
}
However, I get this error:
com.sas.analytics.ph.RTDMException: Failure running user groovy activity
at com.sas.analytics.crm.rtdm.activities.GroovyClassActivity.execute(GroovyClassActivity.java:374)
at com.sas.rtdm.implementation.EventExecutor.execute(EventExecutor.java:243)
at com.sas.rtdm.implementation.TestExecutor.execute(TestExecutor.java:209)
at com.sas.rtdm.implementation.engine.ActivityNode._execute(ActivityNode.java:58)
at com.sas.rtdm.implementation.engine.ActivityNode._execute(ActivityNode.java:18)
at com.sas.rtdm.implementation.engine.SchedulableNode$1.call(SchedulableNode.java:89)
at com.sas.rtdm.implementation.engine.SchedulableNode$1.call(SchedulableNode.java:82)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: groovyx.net.http.HttpResponseException: Not Found
at groovyx.net.http.RESTClient.defaultFailureHandler(RESTClient.java:263)
at sun.reflect.GeneratedMethodAccessor272.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1210)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1077)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019)
at groovy.lang.Closure.call(Closure.java:426)
at groovyx.net.http.HTTPBuilder$1.handleResponse(HTTPBuilder.java:503)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:945)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:919)
at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:515)
at groovyx.net.http.RESTClient.post(RESTClient.java:141)
at groovyx.net.http.RESTClient$post.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at callmpgPortout.run(script15071903301131828657077.groovy:31)
at com.sas.analytics.crm.rtdm.activities.GroovyClassActivity.execute(GroovyClassActivity.java:362)
... 10 more
2017-10-05 15:58:50,302 INFO sasdemo SASDSDesignRepository com.sas.rtdm.implementation.TestExecutor - TestExecutor shutting down.
2017-10-05 15:58:50,302 INFO sasdemo SASDSDesignRepository com.sas.rtdm.implementation.EventExecutor - EventExecutor shutting down.
2017-10-05 15:58:50,302 INFO sasdemo SASDSDesignRepository com.sas.rtdm.implementation.engine.concurrent.RTDMConcurrentExecutor - RTDMConcurrentExecutor shutting down.
2017-10-05 15:58:50,302 INFO sasdemo SASDSDesignRepository com.sas.rtdm.implementation.engine.concurrent.RTDMConcurrentExecutor - RTDMConcurrentExecutor shutdown complete.
2017-10-05 15:58:50,302 INFO sasdemo SASDSDesignRepository com.sas.rtdm.implementation.RTDMObjectFactory - RTDMObjectFactory shutting down.
2017-10-05 15:58:50,302 INFO sasdemo SASDSDesignRepository com.sas.rtdm.implementation.resource.ResourcePool - ResourcePool sync monitor shutting down.
2017-10-05 15:58:50,302 INFO sasdemo SASDSDesignRepository com.sas.rtdm.implementation.resource.ResourcePool - ResourcePool sync monitor shutdown complete.
2017-10-05 15:58:50,302 INFO sasdemo SASDSDesignRepository com.sas.rtdm.implementation.resource.JDBCConnectionPool - JDBCConnectionValidator shutdown flag set.
2017-10-05 15:58:50,338 INFO sasdemo SASDSDesignRepository com.sas.rtdm.implementation.resource.JDBCConnectionPool - Finished closing pool jdbc:sastkts://sgbdcmprtcapp01:24142
2017-10-05 15:58:50,338 INFO sasdemo SASDSDesignRepository com.sas.rtdm.implementation.resource.JDBCConnectionPool - JDBCConnectionPool for Resource $SAS_Activity_Resource shutdown complete.
2017-10-05 15:58:50,338 INFO sasdemo SASDSDesignRepository com.sas.rtdm.implementation.RTDMObjectFactory - RTDMObjectFactory shutdown complete.
2017-10-05 15:58:50,338 INFO sasdemo SASDSDesignRepository com.sas.rtdm.implementation.EventExecutor - EventExecutor shutdown complete.
2017-10-05 15:58:50,338 INFO sasdemo SASDSDesignRepository com.sas.rtdm.implementation.TestExecutor - TestExecutor shutdown complete.
Am I missing something?
Thanks.