To do POW, you call attachToTangle and do POW on two transactions, branchTransaction and trunkTransaction which you get from calling TransactionsToApprove. The message you want to send is sent in trytes via attachToTangle. Then the resulting trytes from the attachToTangle call are stored and broadcasted to the network via storeTransactions and broadcastTransactions.
I assume with additional javascript calls a wallet can generate a message in trytes which is the one included in attachToTangle which is broadcasted out. However, what if you took the hash from branchTransaction and called getTrytes and then replayed that message as the one in attachToTangle? If this was to send IOTAs - how is it not resent? Also, is this an effective way to spam (and thus help) the network?