Java Call back methods

Hi,

i am using 6.0 version and using RPC for java call backs and facing below issue

when call run action method, if I add the values for “params” parameter request is not reach the java call back method and return with the error message “rpc.internal_error”, if not pass any value any value to “params” parameter it reach to java call back method give response back

Request string with error :

Maapi request error (confd/run_action,
{“th”:4,“path”:"/Fault:fault/notificationAction/alarmSummaryAction",“params":"[{“name”:“summaryRequestFrom”,“value”:“chassisAlarmSummary”}]”}):
{“type”:“rpc.internal_error”,"code":-32603,“message”:"Internal
error (reason unknown)"}

  • at Object.self.fireWith [as resolveWith] (https://x.x.x.x/js/lib/jquery-1.7.1.js:1164:49)
    
  • at done (https://x.x.x.x/js/lib/jquery-1.7.1.js:7399:42)
    
  • at XMLHttpRequest.callback (https://x.x.x.x/js/lib/jquery-1.7.1.js:8180:57)
    

Maapi request error (confd/run_action, {“th”:6,“path”:"/Fault:fault/notificationAction/alarmDisplayAction",“params":"[{“name”:“notificationTable”,“value”:“currentalarms_curralarm”},{“name”:“navPage”,“value”:“1”},{“name”:“sortOrder”,“value”:“desc”},{“name”:“sortColumn”,“value”:“alarmTime”},{“name”:“isSeverityCount”,“value”:“0”}]”}):
{“type”:“rpc.internal_error”,“code”:-32603,“message”:“Internal
error (reason unknown)”}

  • at Object.self.fireWith [as resolveWith] (https://x.x.x.x/js/lib/jquery-1.7.1.js:1164:49)
    
  • at done (https://x.x.x.x/js/lib/jquery-1.7.1.js:7399:42)
    
  • at XMLHttpRequest.callback (https://x.x.x.x/js/lib/jquery-1.7.1.js:8180:57)
    

Java Methods as below:

@ActionCallback(callPoint = Fault.actionpoint_alarmDisplayAction, callType = { ActionCBType.ACTION })

public ConfXMLParam [] alarmDisplay(DpActionTrans trans, ConfTag name, ConfObject[] kp, ConfXMLParam[] params) throws NumberFormatException, IOException, ConfException{

ConfXMLParam[] listParams = null;

@ActionCallback(callPoint= Fault.actionpoint_alarmSummaryAction, callType = { ActionCBType.ACTION })

public ConfXMLParam [] doAction(DpActionTrans trans, ConfTag name, ConfObject[] kp, ConfXMLParam[] params) throws NumberFormatException, IOException, ConfException{

ConfXMLParam[] xmlParamSuccess=null;

Please let me know how i can pass the param values and need to perform the java code.

Thanks
Mohan

I’m not sure if I understand fully tour use case. You probably mean how to action callback in Java with parameters (input in yang).

If this is so, I suggest you study example intro/java/7-actions which describes such scenario. The Java API and Java examples are distributed with ConfD Premium package.

Hi,

Thanks for Suggestion,

Actually my issue is not with creating call back methods in java, in my code java call backs working fine.
The issue is in RPC call with one of the parameters (“params” ) in “run_action” method,
this parameter is mapped to ConfXMLParam[ ], when add this parameter in my Ajax request, its not able to invoke the java call back method and terminate the request with error (
{“type”:“rpc.internal_error”,“code”:-32603,“message”:“Internal error (reason unknown)”}).
As per my understanding following parameter is not able to parse the value/ in put format.

Please suggest me where and how i can debug this issue.

Below is request string and response with error:

(confd/run_action, {“th”:6,“path”:"/Fault:fault/notificationAction/alarmDisplayAction",“params”:"[{“name”:“notificationTable”,“value”:“currentalarms_curralarm”},{“name”:“navPage”,“value”:“1”},{“name”:“sortOrder”,“value”:“desc”},{“name”:“sortColumn”,“value”:“alarmTime”},{“name”:“isSeverityCount”,“value”:“0”}]"})

Response:
Maapi request error (confd/run_action, {“th”:6,“path”:"/Fault:fault/notificationAction/alarmDisplayAction",“params”:"[{“name”:“notificationTable”,“value”:“currentalarms_curralarm”},{“name”:“navPage”,“value”:“1”},{“name”:“sortOrder”,“value”:“desc”},{“name”:“sortColumn”,“value”:“alarmTime”},{“name”:“isSeverityCount”,“value”:“0”}]"}): {“type”:“rpc.internal_error”,“code”:-32603,“message”:“Internal error (reason unknown)”}

  • at Object.self.fireWith [as resolveWith] (https://x.x.x.x/js/lib/jquery-1.7.1.js:1164:49)
    
  • at done (https://x.x.x.x/js/lib/jquery-1.7.1.js:7399:42)
    
  • at XMLHttpRequest.callback (https://x.x.x.x/js/lib/jquery-1.7.1.js:8180:57)
    

Thanks
Mohan

Unfortunately I’m not so familiar with Web based API/ Are you using existing JSON-RPC API for this?
If yes, I suggest you try to create small example against mentioned intro/java/7-actions and (if you can reproduce the behaviour) report it to Tail-f as RT ticket.