Opened 14 years ago

Last modified 14 years ago

#6756 closed defect

JSON Procedure Call with named parameters — at Initial Version

Reported by: guest Owned by: Dustin Machi
Priority: high Milestone:
Component: RPC Version: 1.1.0
Keywords: RPC, JSON, named parameters Cc: alex
Blocked By: Blocking:


It is not possible to make JSON RPC with named parameters.


var myObject = new dojo.rpc.JsonService?("/definition.smd"); var myDeferred = myObject.add(121,5}); myDeferred.addCallback(myCallbackMethod); myDeferred.addErrback(myErrorbackMethod);

add method definition:

methods:[ {

name: "add", parameters: { {

name: "x", type: "integer"

}, {

name: "y", type: "integer"



Expected: params = {x:131,y:5}

Result: [ Error: invalid property id ] [ Error: Unable to load SMD from ]


According to if parameters are given as object than it indicates that named parameters should be used for this method.

It is not possible to give parameters as object. If definition smd is changed to:

methods:[ {

name: "add", parameters: [ {

name: "x", type: "integer"

}, {

name: "y", type: "integer"



submitted parameters are {131,5}

Even in case that it would be possible to load smd with parameters defined as object on line 136 of dojo/rpc/RpcService.js it would not be taken in account but given runtime arguments would be converted to array and submitted as parameters.


  1. Enable parsing smd with parameters given as objec
  1. Follow JSON-RPC (over HTTP) specification/example and correctly pass parameters as position or named.

I could not find out why smd is not parsed (I am new to JavaScript?) but once that is resolved than something like this could be done: add method:

toNamed: function(args, param) {

var i; var data = {}; for (i=0; i<param.length; i++) {

data[param[i].name] = args[i];

} return data;


and than on line 136 do something like this:

if (true === dojo.isObject(parameters)) {

this.bind(method, this.toNamed(dojo._toArray(arguments), parameters), deferredRequestHandler, url);

} else {

this.bind(method, dojo._toArray(arguments), deferredRequestHandler, url);


Change History (1)

Changed 14 years ago by guest

Attachment: dojo.response.txt added

details of error response

Note: See TracTickets for help on using tickets.