It could be the TCM, the solenoid, the 4x4 control module (PCM), the 4x4 relays (located in a small black box in front of the coolant reservoir on the driver side fender), the dash selector switch, or the wiring between any of those components. Generally, the 4x4 module sends signals to the TCM after receiving a command from the dash selector, and then needs confirmation from the TCM that it has moved to the appropriate location. Remember also that inside the TC there is a clutch that engages/disengages the forward driveshaft. This is a magnetic clutch with mechanical lockup. You could also have an internal transfer case problem. Have you checked the fluid level and condition?