# Java Call back methods

**URL:** <https://dmap-community.ductus.global/t/java-call-back-methods/1663>\
**Category:** Core Engine and APIs\
**Created:** [November 28, 2017, 8:47am UTC](https://dmap-community.ductus.global/t/java-call-back-methods/1663 "2017-11-28T08:47:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohank](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@mohank](https://dmap-community.ductus.global/u/mohank)\
**Post date:** [November 28, 2017, 8:47am UTC](https://dmap-community.ductus.global/t/java-call-back-methods/1663/1 "2017-11-28T08:47:41Z")

</div>

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\_erro** r”, 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

---

<div class="post-metadata">

**Author:** ![mnovak](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mnovak/32/183_2.png) [@mnovak](https://dmap-community.ductus.global/u/mnovak)\
**Post date:** [November 28, 2017, 8:55am UTC](https://dmap-community.ductus.global/t/java-call-back-methods/1663/2 "2017-11-28T08:55:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mohank](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@mohank](https://dmap-community.ductus.global/u/mohank)\
**Post date:** [November 29, 2017, 5:08am UTC](https://dmap-community.ductus.global/t/java-call-back-methods/1663/3 "2017-11-29T05:08:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mnovak](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/mnovak/32/183_2.png) [@mnovak](https://dmap-community.ductus.global/u/mnovak)\
**Post date:** [November 29, 2017, 8:34am UTC](https://dmap-community.ductus.global/t/java-call-back-methods/1663/4 "2017-11-29T08:34:04Z")

</div>

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.
