Israel is not quite insane enough to commit and act of war against a UNSC member it doesn't already control.
Are you implying Israel committing act of war on US is fine?
There is no reason why Israel would do that so an attack on a Chinese embassy will never happen.
However if you are asking what would China do in a purely hypothetical scenario if their embassy is attacked.. Well the proper response would be to retaliate in kind. That is if a Chinese diplomat is killed then an Israeli diplomat would have to be killed. Bullies only understand the language of strength, if you show weakness they will just push for more. the burden of de-escalation should be on the ones who started it not on the victim. A victim should not turn the other cheek after being slapped.
Historicaly when the US bombed the Chinese embassy in Belgrade. the Chinese didn't retaliate in kind because they were biding their time to grow larger. China was just starting to build itself up so it was unwise to retaliate in kind to the US. this time things are different, the Chinese military of 2024 is nothing like that of the nineties. No one will dare repeat the stunt of 1999 against a Chinese embassy.
In the hypothetical scenario, I think China will retaliate, but not necessarily a equal exchange. 你打你的我打我的。It could be retaliation in another form at appropriate level. By appropriate level it could be above or below what Israel did. For example, if it was intended to hit military target nearby but missed, then the retaliation level would be lower. If it was intended to probe for further aggression, then the retaliation would equal or higher.
I expect the same to play out for Iran. They will retaliate in other forms, but I do not expect Iran to formally retaliate in the same manner. I do not expect Iran to blow up Israeli embassy somewhere. Iran might blow up some hidden Mossad office they find somewhere.