Test WCTS

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<input id="gppKey" placeholder="la clé géoportail">
<input type="button" onclick="go()" value="Go!">
<hr>
<div id="form">
  SourceCRS :
  <select name="SourceCRS">

  </select>
  TargetCRS :
  <select name="TargetCRS">

  </select>
  <br> x:
  <input id="x" placeholder="x" value="662350.48" size="7"> y:
  <input id="y" placeholder="y" value="6863682.29" size="7">
  <input type="button" onclick="transform()" value="TransformCoordinates">
  <br>
  <textarea id="result" rows="5" cols="60"></textarea>

</div>

JavaScript

$("#gppKey").val(localStorage.getItem('gppKey'));
window.go = function() {
  var key = $("#gppKey").val();
  window.key = key;
  localStorage.setItem('gppKey', key);
  $("#form").css("visibility", "visible");
  checkCRS();
}

window.checkCRS = function() {
  var key = window.key;
  var url = "https://wxs.ign.fr/" + key + "/wcts/wps?service=WPS&request=DescribeProcess&version=1.0.0&identifier=TransformCoordinates"
  $.get({
    url: url,
    success: function(data) {
    
      xmlDoc = $.parseXML(data);
      $(xmlDoc).find("Input").each(function() {
        var id = $(this).find("ows\\:Identifier").text();
        if (id==""){id = $(this).find("Identifier").text()}
        if (id == "SourceCRS" || id == "TargetCRS") {
          var defaultcrs = $(this).find("DefaultValue").text();
          $(this).find("ows\\:Value").each(function() {
            var crs = $(this).text();
            $("select[name=" + id + "]").append("<option value='" + crs + "'" + (crs == defaultcrs ? " selected" : "") + ">" + crs + "</option>")
          })
          $(this).find("Value").each(function() {
            var crs = $(this).text();
            $("select[name=" + id + "]").append("<option value='" + crs + "'" + (crs == defaultcrs ? " selected" : "") + ">" + crs + "</option>")
          })
        }
      })
    }
  });
}

window.transform = function() {
  var key = window.key;
  var url = "https://wxs.ign.fr/" + key + "/wcts/wps"
  var sourceCRS = $("select[name=SourceCRS]").val();
  var targetCRS = $("select[name=TargetCRS]").val();
  var coordinates = $("#x").val().replace(',', '.') + "," + $("#y").val().replace(',', '.');
  var req = requestTemplate.replace("[[SOURCECRS]]", sourceCRS).replace("[[TARGETCRS]]", targetCRS).replace("[[COORDINATES]]", coordinates);
  $.ajax({
    method: "POST",
    url: url,
    data: req,
    success: function(data) {
      $("#result").empty().append(data);
    },
    contentType: "application/xml"
  }).fail(function() {
    alert("Erreur, voir...