There is only 2 options. either u fight or u try to run (running isnt a good option all the time)
fighting. use most of your defensive cooldowns and burst his face off. and pray for no deflects or that he isnt using his defensive cooldowns. knockhim back pin him down.
this can be very troublesome if he already has high resolve or full resolve. then u are pretty screwed if u cant kill him during entrench and ballistic/shield probe(or both)
generally i do not fear the melee i just dont like fighting em cuz some of em know how to play
tldr
Defensive cooldowns shot him in the face
legshot run away flashbang run away leg shot hope he gives up.