I'm going to stay in Shanghai on a student visa from February to June. I want to travel to Japan while I'm in Shanghai. I'm a citizen of Kazakhstan, how can I apply for a visa to Japan in Shanghai? Is it possible? What are the requirements?
I realise this isn't a full answer to your question, but I hope it helps.
I had a look on the Shanghai embassy of Japan page, which doesn't say either way. However, the Japanese embassy in the UK sheds some light on the matter, and so this may apply to you.
If you have a long term visa for the UK (i.e. you aren't a tourist) then you can apply for a Japanese visa from the local UK embassy. This would suggest if you have a non-tourist visa for China (which you do as a student) then you can apply at the Shanghai embassy.
If you are in the UK as a tourist then you can't apply for a Japanese tourist visa as a foreign national - you need to apply through the Japanese embassy in your own country.
Whether or not the same rules apply at the Shanghai embassy, I can't say. I'd suggest you (or a Chinese friend) contact them on firstname.lastname@example.org, or on 010-8531-9800.
However, as you're not in China yet I'd suggest applying for a tourist visa now through the Kazakh-Japanese embassy - see http://www.kz.emb-japan.go.jp/visa-tourism/visa.htm.