Thank you guys! After creating a geoprocessing tool, then we can call it from the client. Are there any examples? I should Google it by myself, but if it is convenient for you, the answers are highly appreciated.
Once you have got your geoproceesing service running on your server you can use the geoprocessing widget (if you are using the flex viewer) to run your gpservice: