Unfortunately, this, one of the most popular classic puzzles, has no solution. At least, one wall always will be left unpassed.
It was easy proved by Martin Gardner. The proof (adopted to our case with the walls and rooms) is as follows: A continuous line that enters and leaves one of the rectangular rooms must of necessity cross two walls. Since the three bigger rooms have each an odd number of walls to be crossed, it follows that an end of a line must be inside each if all the 16 walls are crossed. But a continuous line has only two ends, so the puzzle is insoluble.