PHP Soap and REST based service best practise -


i working on library implement soap , rest based client letting library user decide between soap or rest.

my question is; service consuming has ton of operations/functions call, debtor_getall, debtor_create, debtor_update, debtor_find_by_name , forth.

should represent each operation/function service offers method in interface this

interface iservice { public function debtor_get_all(); public function debtor_create($params); public function debtor_update($params); public function debtor_find_by_name($name); } 

or should try abstract service , implement like

interface iservice { public function get( $debtor_id ); public function post( $params ); public function put( $params ); } 

in order soap , rest adhere same "vocabulary"? first option gives me ton of methods implement, each doing unique job. second options gives me less methods implement more complex logic per method. more complex since get() method have handle both debtor_get_all debtor_find_by_name.

the soap client implement interface , take care of soap based communication, , rest based client same.

but best option between two, , there third or forth haven't come across yet?

possible solution

namespace services;  interface iservice {}  namespace services;  class baseservice {}  namespace services\soap;  class debtor extends baseservice implements iservice {}  class invoice extends baseservice implements iservice {}  namespace services\rest;  class debtor extends baseservice implements iservice {}  class invoice extends baseservice implements iservice {} 


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -