Just to clarify, James is arguing that science *can't* altogether invalidate religion. Either way, though, I think it would be interesting to hear people's thoughts on the relationship between science and religion and to discuss what James (or pragmatism in general) has to say about it.
One popular resolution to the science/religion question that James rejects is the idea of separate spheres corresponding to separate kinds of truth. That is, he doesn't think that we use one kind of knowledge when dealing with the physical world described by science and a different kind of knowledge when dealing with emotional, ethical, or religious matters. Instead, he sees both science and religion growing as branches of one underlying kind of knowledge, which is the kind generated by subjecting beliefs to the test of future experience, i.e., judging things by their fruits. This common standard of knowledge, which science must accept, can be used, James argues in this passage from "The Religion of Healthy-Mindedness," to question not science itself, but some of the metaphysical assumptions that scientists tend to make, such as the idea that nature contains only impersonal forces:
There are plenty of persons to-day--"scientists" or "positivists," they are fond of calling themselves--who will tell you that religious thought is a mere survival, an atavistic reversion to a type of consciousness which humanity in its more enlightened examples has long since left behind and out-grown. If you ask them to explain themselves more fully, they will probably say that for primitive thought everything is conceived of under the form of personality. The savage thinks that things operate by personal forces, and for the sake of individual ends. For him, even external nature obeys individual needs and claims, just as if these were so many elementary powers. Now science, on the other hand, these positivists say, has proved that personality, so far from being an elementary force in nature, is but a passive resultant of the really elementary forces, physical, chemical, physiological, and psycho-physical, which are all impersonal and general in character. Nothing individual accomplishes anything in the universe save in so far as it obeys and exemplifies some universal law. Should you then inquire of them by what means science has thus supplanted primitive thought, and discredited its personal way of looking at things, they would undoubtedly say it has been by the strict use of the method of experimental verification. Follow out science's conceptions practically, they will say, the conceptions that ignore personality altogether, and you will always be corroborated. The world is so made that all your expectations will be experientially verified so long, and only so long, as you keep the terms from which you infer them impersonal and universal.
But here we have mind-cure, with her diametrically opposite philosophy, setting up an exactly identical claim. Live as if I were true, she says, and every day will practically prove you right. That the controlling energies of nature are personal, that your own personal thoughts are forces, that the powers of the universe will directly respond to your individual appeals and needs, are propositions which your whole bodily and mental experience will verify. And that experience does largely verify these primeval religious ideas is proved by the fact that the mind-cure movement spreads as it does, not by proclamation and assertion simply, but by palpable experiential results. Here, in the very heyday of science's authority, it carries on an aggressive warfare against the scientific philosophy, and succeeds by using science's own peculiar methods and weapons. Believing that a higher power will take care of us in certain ways better than we can take care of ourselves, if we only genuinely throw ourselves upon it and consent to use it, it finds the belief, not only not impugned, but corroborated by its observation.
This argument really cuts Richard Dawkins type arguments for atheism off at the knees, if you ask me. But James is nothing if not evenhanded, and what he gives with one hand he often takes away with the other. Religion, too, must accept the common standard of judging beliefs by their fruits. According to that standard one can never be bound by eternally fixed commandments or creeds. Likewise one must subject any part of one's beliefs that can be evaluated scientifically to such evaluation, even if the results might contradict sacred teachings. You might say, then, that for James science and religion humble each other (or "unstiffen" each other, to use a Jamesian word.)