The term 'projection' is often used as a synonym for the more correct term, coordinate reference system (CRS), which can include geographic and projected coordinate reference systems.
When a geographic CRS is displayed in two dimensions, its angular units are treated as if they are linear--they're just displayed. They are not displayed using a Mercator projection algorithm. The closest projection algorithm is Plate Carrée. Its forward equations are:
x (easting) = R*lambda (if the central meridian is zero)
y (northing) = R*phi
where
R = radius of the sphere (in your case the semimajor axis of WGS84 would be used)
lambda = longitude in radians
phi = latitude in radians
so you can see that true Plate Carrée coordinates are just scaled compared to displaying latitude-longitude values in degrees.
While the x equation is the same for the spherical Mercator equations, the y equation is different:
y = R ln tan (PI/4 + phi/2)
When you request data from an image-based web service like WMS, usually the layers have been cached (pre-built) in various CRS. The service then publishes which CRS are supported.
Note: Unfortunately, my company (Esri) is guilty of popularizing the usage of 'projection' instead of 'coordinate reference system'. I would just like to state that I started at Esri after that erroneous usage began.
I'd suggest not writing this yourself, but instead using one of the existing coordinate transform libraries, such as proj4j or the CRS part of GeoTools. From GeoTools (with some JTS help):
import com.vividsolutions.jts.geom.Geometry;
import org.geotools.geometry.jts.JTS;
import org.geotools.referencing.CRS;
import org.geotools.geojson.geom.GeometryJSON;
String SoldnerBerlinWKT = "PROJCS[\"DHDN / Soldner Berlin\","
+ "GEOGCS[\"DHDN\",DATUM[\"Deutsches_Hauptdreiecksnetz\","
+ "SPHEROID[\"Bessel 1841\",6377397.155,299.1528128,AUTHORITY[\"EPSG\",\"7004\"]],"
+ "AUTHORITY[\"EPSG\",\"6314\"]]," +
+ "PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],"
+ "UNIT[\"degree\",0.01745329251994328,AUTHORITY[\"EPSG\",\"9122\"]],"
+ "AUTHORITY[\"EPSG\",\"4314\"]]," +
+ "UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],"
+ "PROJECTION[\"Cassini_Soldner\"],PARAMETER[\"latitude_of_origin\",52.41864827777778],"
+ "PARAMETER[\"central_meridian\",13.62720366666667],PARAMETER[\"false_easting\",40000],"
+ "PARAMETER[\"false_northing\",10000],"
+ "AUTHORITY[\"EPSG\",\"3068\"],AXIS[\"y\",EAST],AXIS[\"x\",NORTH]]";
CoordinateReferenceSystem sourceCRS = CRS.parseWKT(SoldnerBerlinWKT);
CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:4326");
MathTransform transform = CRS.findMathTransform(sourceCRS, targetCRS, true);
GeometryJSON jsonReader = new GeometryJSON();
Geometry sourceGeometry = jsonReader.read(inputStreamWithJSONdata);
// you could also get the sourceGeometry using the read(Object) method,
// which takes a File, or a String containing a filename, or a Reader
// instance.
Geometry targetGeometry = JTS.transform(sourceGeometry, transform);
If you'd like another language, see http://trac.osgeo.org/proj/ or one of the other variants linked off the metacrs page.
Best Answer
Have a look at this documentation of CRS http://docs.geotools.org/latest/userguide/library/referencing/crs.html#well-known-text
It is possible to set the CRS from WKT. The documentation says:
It is possible to get the WKT from the PRJ file or even from http://spatialreference.org/ref/sr-org/nad_1983_stateplane_texas_central_fips_4203_feet/ogcwkt/
Once the CRS is set from the WKT, the rest of the process is as it was.