function for post and retrieve data from web service