In the top voice, you can see the soprano melody notated in the key of B minor (with 2 sharps). I used harmonic minor mode with the raised 7th scale degree - A#.
The process of the harmonization was as follows:
1. I sang the melody and indicated the place to breath - before the pick up to the 5th measure (it's called the caesura).
2. I then imagined the scale degree numbers of the B minor scale and thought about what chords could go with each note (this scale and the chords are notated below the harmonization).
3. Then I harmonized the two cadences (m. 4 and m. 8).
4. Finally, I started from the beginning and wrote the entire bass line first and filled in the missing alto and tenor parts later.
Of course, you could simply start from the beginning and harmonize the melody until the end. But completing important structural points (cadences) first (at least in your mind) helps to avoid mistakes in chord choice and voice leading.
In this type of harmonization, the rules are quite simple: avoid parallel 5ths and 8ths between the voices, use contrary motion in the bass (compared to soprano) as much as possible, avoid voice crossing (for example, the alto can't descend lower than the tenor).
The widest distance between the three top voices could be an octave. The widest distance between the bass and the tenor - much wider.
A note about the doubling of voices in three-note chords: in root position chords double the root (most often). In the first inversion, double the root or the fifth. In the second inversion chord, double the bass.
If the voice leading permits, in II, IV, V and VII+ scale degrees you could use inversions of D7 chords. Leave the D7 chord for the final cadence.
Here is the PDF file for printing and the MIDI file for listening. Play this exercise on your instrument to see if you like it and understand it.
(Optional) After you are done, transpose it to C minor (with 3 flats) or D minor (with 1 flat).