My friend often times goes to conventions, so here's what I've gathered from what he's told me.
Female cosplayers are often criticized for their outfits. Some have apparently been told that they're "asking for it" because of what they're wearing. Unfortunately, this is sometimes the appeal of going to a convention for some people.
For what the community can do, I would say having some sort of message (if there's a list of panel times that everyone picks up, for example) that explains how intolerable harassment is, and people to contact if you are harassed.