I want to put some code when an order change from new to processing.
I found the changeState and setState method but it is not the right place for me.
I explain.
I want a code (used in admin and front) thaht will be executed after payment success (if Card payment is used), or after admin click on invoice button in admin (in the other case)
The aim of this code is to ckeck vi SOAP a databse and cancel invoice or not ?
I hope someone know where exactly is the best place for that.
I found some files but was not able to cancel invoice generation.
therefor you have to extend the controllers, the admin controller for invoice and the frontend controller for sucess action.
Look for the used action and cutomize for your needs.
Try reading about the Event system in Magento, that should get you started in the right direction. If you do enough digging, you can solve most integration problems without hacking at the Magento core.