Unfortunately it's going to be difficult to trace John any further using the details to hand - since he died before the start of civil records there will be no death cert. The alternate option is to try parish records. He is shown as 'P' Protestant on his service records so most likely Church of Ireland, but early Taghmon parish records do not survive. A parish or at least approximate area would be required to check availability of death records for other areas - very few Church of Ireland parish records for Co. Wexford are available on line. Another option might be a search for a possible headstone transcript - although bear in mind that not every grave had a headstone, and many early headstones are now illegible or long fallen over.
Similarly working back with any certainty is also going to be a problem without additional details - e.g. a more detailed location or some family information such as father's name and occupation. 'Dublin' can refer to the City, Suburbs or County, and there are quite a few parishes, many of which are not available online, and others where older records no longer survive. Church of Ireland Records for most of the Dublin City parishes are available on the free IrishGenealogy website.
Some of the R.I.C. records include the name of a reference used when joining, which is generally a prominent person in the area the applicant lived - this can be a useful clue as to his origin, but this example doesn't include that... R.I.C. were not usually allowed marry until they have served a certain number of years, I believe 7, so there may be a civil marriage record (since they appear to be CofI) some time after 1852 for James and his wife - do you know Elizabeth's surname or where their children were born ?