Try MELTS WS Compute web service
Use this simple form to test the MELTS WS Compute web service. The results returned show examples of how to construct the XML string in a browser form, of the XML output returned, and of input and output JSON.
Javascript used to process form
$('#MeltsInputForm').submit(function() {
var formxml = "<?xml version='1.0' encoding='UTF-8'?><MELTSinput>";
formxml += "<initialize>";
formxml += "<SiO2>" + document.MeltsInputForm.SiO2.value + "</SiO2>";
formxml += "<TiO2>" + document.MeltsInputForm.TiO2.value + "</TiO2>";
formxml += "<Al2O3>" + document.MeltsInputForm.Al2O3.value + "</Al2O3>";
formxml += "<Fe2O3>" + document.MeltsInputForm.Fe2O3.value + "</Fe2O3>";
formxml += "<Cr2O3>" + document.MeltsInputForm.Cr2O3.value + "</Cr2O3>";
formxml += "<FeO>" + document.MeltsInputForm.FeO.value + "</FeO>";
formxml += "<MnO>" + document.MeltsInputForm.MnO.value + "</MnO>";
formxml += "<MgO>" + document.MeltsInputForm.MgO.value + "</MgO>";
formxml += "<NiO>" + document.MeltsInputForm.NiO.value + "</NiO>";
formxml += "<CoO>" + document.MeltsInputForm.CoO.value + "</CoO>";
formxml += "<CaO>" + document.MeltsInputForm.CaO.value + "</CaO>";
formxml += "<Na2O>" + document.MeltsInputForm.Na2O.value + "</Na2O>";
formxml += "<K2O>" + document.MeltsInputForm.K2O.value + "</K2O>";
formxml += "<P2O5>" + document.MeltsInputForm.P2O5.value + "</P2O5>";
formxml += "<H2O>" + document.MeltsInputForm.H2O.value + "</H2O>";
formxml += "</initialize>";
formxml += "<calculationMode>";
if (document.MeltsInputForm.findLiquidus.checked) formxml += "findLiquidus";
else if (document.MeltsInputForm.equilibrate.checked) formxml += "equilibrate";
else if (document.MeltsInputForm.findWetLiquidus.checked) formxml += "findWetLiquidus";
formxml += "</calculationMode>";
formxml += "<title>" + document.MeltsInputForm.title.value + "</title>";
formxml += "<constraints>";
formxml += "<setTP>";
formxml += "<initialT>" + document.MeltsInputForm.initialT.value + "</initialT>";
formxml += "<initialP>" + document.MeltsInputForm.initialP.value + "</initialP>";
formxml += "</setTP>";
formxml += "</constraints>";
formxml += "</MELTSinput>";
$('div#inputXML').readableXML(formxml);
$('div#inputJSON').text(JSON.stringify($.xml2json($.parseXML(formxml)), undefined, 2));
$.ajax({ type:"POST",
url:"http://thermofit.ofm-research.org:8080/multiMELTSWSBxApp/Compute",
data: formxml,
dataType:"xml",
cache:false,
contentType:"text/xml",
success: function(data) {
$('div#outputXML').readableXML((new XMLSerializer()).serializeToString(data));
$('div#outputJSON').text(JSON.stringify($.xml2json(data)), undefined, 2);
$('div#Results').css('visibility', 'visible');
}
});
return false;
});
Results from server
Input XML displayed on submit
Input JSON displayed on submit
Output XML displayed on return
Output JSON displayed on return