You write WebServices in Dynamics AX 2009 (and 2012) in X++. The overall sub-system for webservices and more ways to integrate is called AIF. In order to use it you need to set it up first as described here. On how to create the simple WebService is shown in a great video here. And you can download a Microsoft guide with tips on how to do it better from here.
Here you can find development center with a lot of helpful resources.
Inside Microsoft Dynamics AX 2009 (here) describes AIF on Chapter 17th. All MS books on later versions do the same.
Tip: Microsoft employees are encouraged and motivated to answer AX questions on MS website.