Simple Method Description For JSON-RPC Example

//SMD for a JSON-RPC service example

{
 transport: "RAW_POST",  

 envelope: "JSON-RPC", 

 serviceUrl: "/service",

 methods: { 
  add: {
   parameters: [  // an array indicates that positional parameters should be used for this method
    {type: "integer", default: 0},
    {type: "integer", default: 0},
   ],

   returns:"integer"
  },

  divide: {

    description:"Do division",

    parameters: { // an object indicates that named parameters should be used for this method

     divisor:{type:"integer"},

     dividend:{type:"integer"}

    },

    returns:"float"

  },

  simple: {},// no requirements on parameters or return type

  getAddress : {

    description : "Takes a person and returns an address",

    parameters : {

     person : {type: // for the type we use a schema

      {firstName:{type:"string"},lastName:{type:"string"}}

     },

    },

    returns : // use a schema for the return type

        {street:{type:"string"},zip:{type:"string"},state:{type:"string"},town:{type:"string"}}

  }

 }

}